openworm / geppetto-application

Sample Geppetto application
http://geppetto.org
Other
3 stars 1 forks source link

Build error on windows #19

Closed filippomc closed 5 years ago

filippomc commented 5 years ago

The build fails on windows with the following error:

$ npm run build-dev

> geppetto-application@1.0.0 prebuild-dev C:\Users\filip\geppetto-application
> eslint --ignore-pattern 'node_modules/*' --ignore-pattern 'geppetto-client/node_modules' . --color && eslint ./node_modules/@geppettoengine/geppetto-client/js/**/*.js --color

Error: Cannot find module 'eslint-config-mourner'
Referenced from: C:\Users\filip\geppetto-application\node_modules\@mapbox\mapbox-gl-supported\.eslintrc
    at ModuleResolver.resolve (C:\Users\filip\geppetto-application\node_modules\eslint\lib\util\module-resolver.js:72:19)
    at resolve (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config\config-file.js:484:28)
    at load (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config\config-file.js:556:26)
    at configExtends.reduceRight (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config\config-file.js:430:36)
    at Array.reduceRight (<anonymous>)
    at applyExtends (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config\config-file.js:408:26)
    at loadFromDisk (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config\config-file.js:528:22)
    at Object.load (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config\config-file.js:564:20)
    at Config.getLocalConfigHierarchy (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config.js:240:44)
    at Config.getConfigHierarchy (C:\Users\filip\geppetto-application\node_modules\eslint\lib\config.js:192:43)
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! geppetto-application@1.0.0 prebuild-dev: `eslint --ignore-pattern 'node_modules/*' --ignore-pattern 'geppetto-client/node_modules' . --color && eslint ./node_modules/@geppettoengine/geppetto-client/js/**/*.js --color`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the geppetto-application@1.0.0 prebuild-dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\filip\AppData\Roaming\npm-cache\_logs\2019-07-31T10_18_08_871Z-debug.log

2019-07-31T10_18_08_871Z-debug.log

filippomc commented 5 years ago

It looks like in windows eslint is recursively looking for .eslint files inside node_modules. The problem seems related to this: https://github.com/eslint/eslint/issues/9227. Ignoring node_modules in .eslintignore fixes the problem but with this we cannot do the check on geppetto-client anymore with eslint ./node_modules/@geppettoengine/geppetto-client/js/**/*.js on the application. Do we really want to check the linting of geppetto-client on the application build? cc @tarelli @rodriguez-facundo

filippomc commented 5 years ago

With the fix above, another error occurs:

ERROR in ./node_modules/css-loader!./node_modules/less-loader/dist/cjs.js?{"modifyVars":{"url":"'C:/Users/filip/geppetto-application/css/colors'"}}!./node_modules/@geppettoengine/geppetto-client/js/components/interface/share/Share.less
Module build failed:

//Set based on GeppettoConfiguration
@import "@{url}";
^
Can't resolve './C:Users
                        ilipgeppetto-applicationcsscolors.less' in 'C:\Users\filip\geppetto-application\node_modules\@geppettoengine\geppetto-client\style\less\components'
      in C:\Users\filip\geppetto-application\node_modules\@geppettoengine\geppetto-client\style\less\components\colors.less (line 2, column 0)
 @ ./node_modules/@geppettoengine/geppetto-client/js/components/interface/share/Share.less 4:14-204
 @ ./node_modules/@geppettoengine/geppetto-client/js/components/interface/share/Share.js
 @ ./components/Application.js
 @ ./Main.js

Related to windows \ path separators?

rodriguez-facundo commented 5 years ago

I tested this one and I found that the build is not working properly on windows. If we delete the linting, we still have a wrong build process.

Unfortunately, the virtual machine I used for windows is insanely slow. Just switching tabs takes a good 4 to 6 seconds. I dont think I am going to be able to debug this one unless I get my hands on a windows machine

filippomc commented 5 years ago

Thanks @rodriguez-facundo maybe I can try tix this myself. Anyway this is not in the roadmap yet. @tarelli do we want to give priority to this?

tarelli commented 5 years ago

Probably not a burning priority but definitely for the roadmap.

tarelli commented 5 years ago

Proposal to fix eslint: if geppetto-client is inside node_modules with the latest proposal from Facu that means that gptclient is coming from npm, in that case there's no need to run the linter. If geppetto-client is coming from sources and we need to elint it we'd need to run the linter on the geppetto-client folder which is a sibling of node_modules. A global ignore of node_modules in conjunction with linting the gepetto-client folder if this exists should fix the problem.

tarelli commented 5 years ago

Once the elint problem is fixed we need someone with a native Windows to try and understand the problem with the build. Maybe @jrmartin can give this a try after the tests.

jrmartin commented 5 years ago

I tested this on Windows and there's no eslint errors. I used geppetto-application branch feature/19 with 'development' for geppetto-client.

However, there are more errors during the mvn clean install image

This one I used to get every single time a couple of years ago when I was on Windows, only solution I found back then was to replace ${useSsl} and ${embedded} to boolean 'false'.

Once passed this error, I get the other errors Filippo has reported in this card. image

Haven't spent much time attempting to find fixes, work in progress.

jrmartin commented 5 years ago

Fixed the issue on windows, the problem (with npm build) was with one of the URL/paths used in webpack.config.js . In windows, the path had backward slashes, changing them to forward slashes fixes the build. The UR/Path causing the trouble was the one pointing to the CSS files.

Also, another error happening in windows, was in the pom.xml. During the build, it was trying to access properties 'useSSL, embedded and embedderURL', which are in GeppettoConfiguration.json . If the gepeptto configuration json doesn't have any values for these variables during the windows installation, the installation breaks since these variable will be null, in UNIX this is not an issue. To get around it, these properties are declared in the pom.xml as part of the tag where already is, and left blank. By having them blank as part of the tag this issue doesn't happen in windows, and doesn't break anything in UNIX.

Opened PRs with the changes.

PR in geppetto-application with webpack.config.js change: https://github.com/openworm/geppetto-application/pull/33

PR in org.geppetto.frontend with pom.xml change https://github.com/openworm/org.geppetto.frontend/pull/892

Screenshot (2)