Mapstore compile problems

370 views
Skip to first unread message

Mats Elfström

unread,
Aug 16, 2021, 4:20:56 AM8/16/21
to mapstore-users
Hi!
I am having problems compiling Mapstore2 with the given instructions.
The README.md on GitHub says to use these commands to build and start a local instance.
npm cache clean (this is useful to prevent errors on Windows during install)
npm install
npm start
The first command appears to be deprecated, and the second fails with this error.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: maps...@0.3.0
npm ERR! Found: re...@16.10.1
npm ERR! node_modules/react
npm ERR!   react@"16.10.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0" from @geosolutions/react-...@1.10.2
npm ERR! node_modules/@geosolutions/react-joyride
npm ERR!   @geosolutions/react-joyride@"1.10.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
The third command will of course fail as well. However, on this page (https://mapstore.readthedocs.io/en/latest/developer-guide/building-and-deploying/), the user is told to use maven instead of npm, like this
mvn clean install -Dmapstore2.version=[version_identifier] [profiles]
or
mvn clean install -Dmapstore2.version=[version_identifier] -Prelease
Both of these command lines works, and will produce a complete output.
However, there seems to be no equivalent for npm start (mvn start?) to run a local instance. 
So I would like to know how to do this.
The purpose of all this is to run a local instance as a test bed for the Swedish translation of the UI file that I am planning for.

Regards, Mats.E

Matteo Velludini

unread,
Aug 16, 2021, 4:40:58 AM8/16/21
to mapstor...@googlegroups.com
Hello,

The npm start command is used to run a local dev server where the application runs so you can edit the codebase and see the new changes live with hot reload. 
Maven is used to build a WAR which can be deployed in a tomcat web server

If you want to add a new language will be useful this guide (see section How to add a new language)

I suppose you are using the master branch of this https://github.com/geosolutions-it/MapStore2 repository
Can you tell us the versions of node and npm ?
node -v
npm -v

I have just tried and i'm not having any issue

Eventually try to remove the node_modules folder you have and re run 
npm install

Make sure here everything is successful

Let me know if this works for you

Best Regards
Matteo

--
You received this message because you are subscribed to the Google Groups "mapstore-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mapstore-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapstore-users/fd2a508d-d635-4ebe-b8fc-b1d8dcf1b3cfn%40googlegroups.com.


--

Regards,

Matteo Velludini

==

GeoServer Professional Services from the experts!

Visit http://bit.ly/gs-services-us for more information.

==

Matteo Velludini

Frontend Software Engineer


GeoSolutions Group
phone: +39 0584 962313

fax:     +39 0584 1660272

mob:   +39  333 8128928


https://www.geosolutionsgroup.com/

http://twitter.com/geosolutions_it

-------------------------------------------------------


Con riferimento alla normativa sul trattamento dei dati personali (Reg. UE 2016/679 - Regolamento generale sulla protezione dei dati “GDPR”), si precisa che ogni circostanza inerente alla presente email (il suo contenuto, gli eventuali allegati, etc.) è un dato la cui conoscenza è riservata al/i solo/i destinatario/i indicati dallo scrivente. Se il messaggio Le è giunto per errore, è tenuta/o a cancellarlo, ogni altra operazione è illecita. Le sarei comunque grato se potesse darmene notizia.

This email is intended only for the person or entity to which it is addressed and may contain information that is privileged, confidential or otherwise protected from disclosure. We remind that - as provided by European Regulation 2016/679 “GDPR” - copying, dissemination or use of this e-mail or the information herein by anyone other than the intended recipient is prohibited. If you have received this email by mistake, please notify us immediately by telephone or e-mail.

Mats Elfström

unread,
Aug 16, 2021, 4:58:19 AM8/16/21
to mapstor...@googlegroups.com
Hi!
Thank you for your attention.
node -v : 14.15.5
npm -v : 7.5.4

I am regularly building Geonetwork and Geoserver on this machine, but they are using maven (Geonetwork to start a local instance as well)
Next I will try to install the release war-file on my Tomcat cloud server.

Regards, Mats.E



--
______________________________________________
Mats Elfström, Väpplingvägen 21, SE-227 38 LUND, Sweden
tel: +46 46 145959 / mob: +46 70 595 39 35
alt e-mail: mats.e...@giskraft.com

Matteo Velludini

unread,
Aug 16, 2021, 5:01:45 AM8/16/21
to mapstor...@googlegroups.com
For building the WAR anyway is better if you run build.sh script as described here

Make sure that the frontend part has built correctly (npm run compile section that depends on npm install) 

Mats Elfström

unread,
Aug 16, 2021, 5:08:03 AM8/16/21
to mapstor...@googlegroups.com
Hmm... a -Prelease build gives this summary:
[INFO] Reactor Summary:
[INFO]
[INFO] MapStore 2 - Backend Services 1.2-SNAPSHOT ......... SUCCESS [  5.732 s]
[INFO] MapStore 2 - WAR 1.2-SNAPSHOT ...................... SUCCESS [  7.515 s]
[INFO] MapStore 2 1.2-SNAPSHOT ............................ SUCCESS [  0.020 s]
[INFO] MapStore Product Web Application 1.2-SNAPSHOT ...... SUCCESS [ 18.532 s]
[INFO] MapStore 2 Release Module WAR ${mapstore2.version} . SUCCESS [ 15.498 s]
[INFO] MapStore 2 Release Module ${mapstore2.version} ..... SUCCESS [02:06 min]
[INFO] MapStore Root 1.2-SNAPSHOT ......................... SUCCESS [  0.028 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:53 min
[INFO] Finished at: 2021-08-16T10:37:36+02:00


Do you see any problems here? The command string was
mvn clean install -Dmapstore2.2 -Prelease

Thanks for help!
Mats.E

Mats Elfström

unread,
Aug 16, 2021, 5:14:07 AM8/16/21
to mapstore-users
Hi!
The freshly built and installed Mapstore war file will not start anyway.
It fails to find a /mapstore/dist/mapstore2.js-file. There is not even a 'dist' folder.
/Mats.E

Matteo Velludini

unread,
Aug 16, 2021, 5:31:59 AM8/16/21
to mapstor...@googlegroups.com
Try with build.sh
you need to run maven after having built the frontend files at least once



Mats Elfström

unread,
Aug 16, 2021, 5:40:36 AM8/16/21
to mapstor...@googlegroups.com
Sadly, ./build.sh gives the exact npm errors as a command line npm install.
Should I try a --force build?

$ ./build.sh 2
Running NPM install to update dependencies
Mon Aug 16 11:27:36 2021

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: maps...@0.3.0
npm ERR! Found: re...@16.10.1
npm ERR! node_modules/react
npm ERR!   react@"16.10.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0" from @geosolutions/react-...@1.10.2
npm ERR! node_modules/@geosolutions/react-joyride
npm ERR!   @geosolutions/react-joyride@"1.10.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!

Matteo Velludini

unread,
Aug 16, 2021, 5:56:18 AM8/16/21
to mapstor...@googlegroups.com
Well, that is the main problem you need to solve, but it is not common to have it.
Maybe you have some node_modules folder duplicated somewhere?

i don't think that --force will fix it

Can you confirm that you have cloned this https://github.com/geosolutions-it/MapStore2  repo?

Mats Elfström

unread,
Aug 16, 2021, 6:01:16 PM8/16/21
to mapstore-users
Hi!
After several hours trying to repair or update the node-npm subsystem I eventually threw it all out and started from scratch.
A brand new node-npm installation managed to create a build according to the instructions.
I have also laid the foundation for a Swedish UI by adding a flag icon, translating the Cookie blob and edited the config files according to instructions.
I have translated some strings in the data.sv-SE.json file which is a copy of the data.en-US.json file.
This all compiles without error, and I can select SVENSKA from the drop down language selector.
Then my luck ended once again. 
Instead of the Swedish strings, the UI shows the string variable names, for instance "Modern webmapping with OpenLayers, Leaflet and ReactJS." is displayed as  home.shortDescription when switched to Swedish. I have translated that string. 
Most likely there is some more configuration needed but I am tired after a day of guessing and trial and error.
The work I have done is in my fork matself/MapStore2 on Github.

Regards, Mats.E

Mats Elfström

unread,
Aug 17, 2021, 3:07:16 AM8/17/21
to mapstore-users
I forgot.
See if you can spot the error.

Matteo Velludini

unread,
Aug 17, 2021, 4:36:06 AM8/17/21
to mapstor...@googlegroups.com
Hi, this is related to how you have configured the locale.
You need to change everywhere how you identify the locale from sv-SE to se-SE

And by everywhere i mean
- name of the translation file
- locale value inside that file
- localConfig in the locale code
- flags (add also the se.png)
- fragments filename for cookie

image.png

Anyway by doing this you are changing a forked version of the main mapsotre repository
This is usually not recommended, (because you need to solve potential conflicts, keep aligned etc) 
unless you want to create a PR for adding swedish inside mapstore
Bear in mind that we officially only support 5 main locales (en, it, es, fr, de) we do not maintain other locales

Also do not remove any messages from your swedish locale file like "home.Applications" because you will end up seeing the path to the locale message instead of the message.

If you want to customize mapsore more, i suggest to create a project that uses mapstore as submodule
for more info see here



Mats Elfström

unread,
Aug 17, 2021, 7:19:29 AM8/17/21
to mapstore-users
Hi!
I am not sure about that language code. 
the language code is sv-SE for Swedish (Sweden), and that is what I am used to.
The code se-SE is for Sami (Lule) (Sweden).
Anyway, changing to se-SE breaks the tests for the language switcher so that was no good advice.
As for the supported languages, I see six more locales in the repository (fi, hr, nl, pt,vi, zh). Somebody must be maintaining those?
Earlier this year I completed the Swedish UI for Geonetwork, and it is now part of the official release.
And I maintain that regularly. Geonetwork is on Transifex which of course makes translation work much more efficient.
I will see about the project approach once I have proved to myself that there is a valid build and compile process in the master.
After all, there are 3370 lines in the language file to work through, and I'd like that work to be useful for the community.

Regards, Mats.E

Matteo Velludini

unread,
Aug 17, 2021, 9:10:29 AM8/17/21
to mapstor...@googlegroups.com
You are right, the correct code is sv-SE

I made a couple of changes that you missed inside localeUtils
have a look here

Feel free to provide a PR when you are ready
thanks for your contribution anyway


Mats Elfström

unread,
Aug 17, 2021, 3:31:17 PM8/17/21
to mapstor...@googlegroups.com
Hi Matteo!
Thanks for all the help. The missed item was also missing from the instructions, that is why.
I cannot use build.sh as it is, because the npm test fails on the language items. Apparently the tests cannot cope with a new language.
So I had to comment out that line.
There is now a new POC at http://geodatatorget.se:8080/mapstore/#/ with the sv-SE language file selectable.
I have also discovered that I can work on that file in place and check progress immediately which will make the work a lot easier.
Do not expect a PR any time soon, though. I have spent two days getting practically nowhere, and there are some 3300 lines to translate.
Now I have to return to the problems with metadata in Geoserver .

Regards, Mats.E


You received this message because you are subscribed to a topic in the Google Groups "mapstore-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/mapstore-users/BowLZfOvp-8/unsubscribe.
To unsubscribe from this group and all its topics, send an email to mapstore-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/mapstore-users/CAB1ykbCpe4P46ZZMCN6xUwf4q0-zw6GEkJNDmfhEG4mXG2JgpA%40mail.gmail.com.

Matteo Velludini

unread,
Aug 18, 2021, 4:29:55 AM8/18/21
to mapstor...@googlegroups.com
Hi,

The missed item was also missing from the instructions, that is why.
The instructions present in "How to add a new language were mentioning also the missing changes for LocaleUtils

I cannot use build.sh as it is, because the npm test fails on the language items. Apparently the tests cannot cope with a new language. So I had to comment out that line.
I haven't checked for the tests, so you have to fix them as well in order to let the build to proceed
if you like I have fixed them here so you are good when you will create the PR

I have also discovered that I can work on that file in place and check progress immediately which will make the work a lot easier.
yes, because it is reloaded on every refresh

Do not expect a PR any time soon, though. I have spent two days getting practically nowhere, and there are some 3300 lines to translate.
Yes, adding a new language requires quite some time :)

Thanks and have a good day


Mats Elfström

unread,
Aug 25, 2021, 3:38:52 PM8/25/21
to mapstore-users
Hi!
I am ready to publish the Swedish UI for Mapstore2. I thought I had a valid plan for this, but it has become complicated.
I have forked the repo, and committed the changed and added files.
However, there are several committs now, and some including files that are not to be changed in the official repo.
There seems to be no way to exclude files from the PR, once committed.
These are the new/changed files
C:\GitHub\MapStore2\web\client\translations\data.sv-SE.json
C:\GitHub\MapStore2\web\client\utils\LocaleUtils.js
C:\GitHub\MapStore2\web\client\components\I18N\images\flags\sv-SE.png
C:\GitHub\MapStore2\web\client\translations\fragments\cookie\cookieDetails-sv-SE.html

(then there are _tests_files that need to be edited)
How do I do to commit only those files in order to make a PR?

Regards, Mats.E

Matteo Velludini

unread,
Aug 26, 2021, 3:32:50 AM8/26/21
to mapstor...@googlegroups.com
Hi,

if you want to redo one or more commit you can run this command

git reset HEAD~X

where X is the number of recent commits you are going to recreate
be careful with this number, do not go beyond the number of commits you have created in your branch
or expect some pain :)

Then you can:
- do your changes 
- create the commit 
- create the Pull Request

have a nice day


Mats Elfström

unread,
Aug 26, 2021, 5:18:16 AM8/26/21
to mapstore-users
Hi and thanks for advice. I had considered that, but as it was very easy to isolate my changes, I ended up creating a new fork and tried to do right from the start. So now there is a brand new pull request awating approval. 
Thanks again for useful instructions. Sorry for the mess - I am learning here. 
Best regards, Mats.E

Matteo Velludini

unread,
Aug 26, 2021, 5:47:38 AM8/26/21
to mapstor...@googlegroups.com
Hi, please check my review here

there are some changes that needs to be added in LocaleUtils

Reply all
Reply to author
Forward
0 new messages