INL / corpus-frontend

BlackLab Frontend, a feature-rich corpus search interface for BlackLab.
16 stars 7 forks source link

Big update of nearly all (javascript) build tools and some dependencies #396

Closed KCMertens closed 2 years ago

KCMertens commented 2 years ago

Could you test if you can produce a war from a fresh checkout? I've validated this works for me, but sometimes issues pop up under different OSes or distros, especially with different Node versions.

jan-niestadt commented 2 years ago

Seems to work! (not a fresh checkout but I used mvn clean package, that should be okay right?)

I did notice that you're still using node-sass; I recently switched to dart-sass (npm library is just named 'sass' I think) after having lots of problems building node-sass (in combination with Docker, and various node/npm versions) and that fixed that. You might want to consider this.

Not sure if the Jenkins job that builds corpus-frontend is enabled at the moment BTW, we did have problems with that in the past but I'm not sure what the current status of that is. (UPDATE: never mind, I see it built succesfully)

jan-niestadt commented 2 years ago

(removed, no longer relevant)

KCMertens commented 2 years ago

I did notice that you're still using node-sass; I recently switched to dart-sass (npm library is just named 'sass' I think) after having lots of problems building node-sass (in combination with Docker, and various node/npm versions) and that fixed that. You might want to consider this.

This actually switches from node-sass to sass! Doing so required me to update sass-loader, which required an update of webpack, which... etc. etc.

jan-niestadt commented 2 years ago

My mistake, I wasn't thinking and just built the dev branch instead of this pull request branch... I built this branch now and it failed with the following output:

[INFO] Scanning for projects...
[INFO] 
[INFO] ------------------< nl.inl.blacklab:corpus-frontend >-------------------
[INFO] Building INT Corpus Frontend 2.1.0
[INFO] --------------------------------[ war ]---------------------------------
[WARNING] The POM for velocity-tools:velocity-tools-view:jar:1.4 is missing, no dependency information available
[WARNING] The artifact org.apache.commons:commons-io:jar:1.3.2 has been relocated to commons-io:commons-io:jar:1.3.2
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ corpus-frontend ---
[INFO] 
[INFO] --- buildnumber-maven-plugin:1.3:create (default) @ corpus-frontend ---
[INFO] Storing buildNumber: 2022-02-04 09:54:11 at timestamp: 1643964851203
[INFO] Storing buildScmBranch: update-dependencies
[INFO] 
[INFO] --- frontend-maven-plugin:1.6:install-node-and-npm (install node and npm) @ corpus-frontend ---
[INFO] Node v14.8.0 is already installed.
[INFO] NPM 6.14.7 is already installed.
[INFO] 
[INFO] --- frontend-maven-plugin:1.6:npm (npm install) @ corpus-frontend ---
[INFO] Running 'npm install' in /home/jan/int-projects/corpus-frontend/src/frontend
[WARNING] npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!
[WARNING] npm WARN checkPermissions Missing write access to /home/jan/int-projects/corpus-frontend/src/frontend/node_modules/bootstrap
[WARNING] npm WARN checkPermissions Missing write access to /home/jan/int-projects/corpus-frontend/src/frontend/node_modules/vuex-typex
[WARNING] npm WARN vue-rx@6.2.0 requires a peer of rxjs@^6.0.0 but none is installed. You must install peer dependencies yourself.
[ERROR] 
[ERROR] npm ERR! code ENOENT
[ERROR] npm ERR! syscall access
[ERROR] npm ERR! path /home/jan/int-projects/corpus-frontend/src/frontend/node_modules/bootstrap
[ERROR] npm ERR! errno -2
[ERROR] npm ERR! enoent ENOENT: no such file or directory, access '/home/jan/int-projects/corpus-frontend/src/frontend/node_modules/bootstrap'
[ERROR] npm ERR! enoent This is related to npm not being able to find a file.
[ERROR] npm ERR! enoent 
[ERROR] 
[ERROR] npm ERR! A complete log of this run can be found in:
[ERROR] npm ERR!     /home/jan/.npm/_logs/2022-02-04T08_54_15_066Z-debug.log
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  4.555 s
[INFO] Finished at: 2022-02-04T09:54:15+01:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal com.github.eirslett:frontend-maven-plugin:1.6:npm (npm install) on project corpus-frontend: Failed to run task: 'npm install' failed. org.apache.commons.exec.ExecuteException: Process exited with an error: 254 (Exit value: 254) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoFailureException
KCMertens commented 2 years ago

[WARNING] npm WARN checkPermissions Missing write access to /home/jan/int-projects/corpus-frontend/src/frontend/node_modules/bootstrap [WARNING] npm WARN checkPermissions Missing write access to /home/jan/int-projects/corpus-frontend/src/frontend/node_modules/vuex-typex

Hmm.. These two were previously local dependencies because of some bugs in them (using npm install /path/to/dir/), but due to updates that was no longer required, so I replaced them with the normal dependencies. It seems that leaves the node_modules in a weird state.

This might be a bug in npm and not the configuration on our side, so try nuking node_modules and trying again?

jan-niestadt commented 2 years ago

Aha! Those warnings were two broken symlinks; I removed them and ran the build again. It failed in a different way this time.

I finally tried a true fresh clone, but got the same errors unfortunately:

[INFO] --- frontend-maven-plugin:1.6:npm (npm run build) @ corpus-frontend ---
[INFO] Running 'npm run build' in /home/jan/int-projects/corpus-frontend-fresh/src/frontend
[INFO] 
[INFO] > corpus-frontend@2.1.0 build /home/jan/int-projects/corpus-frontend-fresh/src/frontend
[INFO] > webpack --config webpack.config.prod.js --mode production
[INFO] 
[INFO] assets by status 2.88 MiB [cached] 4 assets
[INFO] orphan modules 1.27 MiB [orphan] 307 modules
[INFO] runtime modules 5.13 KiB 26 modules
[INFO] javascript modules 4.63 MiB
[ERROR] (node:1505) [DEP_WEBPACK_STATS_WARNINGS_FILTER] DeprecationWarning: config.stats.warningsFilter is deprecated in favor of config.ignoreWarnings
[ERROR] (Use `node --trace-deprecation ...` to show where the warning was created)
[INFO]   modules by path ./node_modules/ 2.27 MiB 325 modules
[INFO]   modules by path ./src/ 2.36 MiB
[INFO]     modules by path ./src/pages/ 81.3 KiB 38 modules
[INFO]     modules by path ./src/components/ 24.5 KiB 6 modules
[INFO]     modules by path ./src/modules/ 12.7 KiB 4 modules
[INFO]     modules by path ./src/*.scss 17.3 KiB 4 modules
[INFO]     modules by path ./src/*.ts 836 KiB 3 modules
[INFO]     ./src/utils/enable-polyfills.ts 1.31 KiB [built] [code generated]
[INFO]     ./src/search.tsx + 266 modules 1.41 MiB [built] [code generated]
[INFO]   ./util.inspect (ignored) 15 bytes [built] [code generated]
[INFO] ./node_modules/axios/package.json 2.56 KiB [built] [code generated]
[INFO] 
[INFO] ERROR in ./src/pages/search/form/Lexicon.vue?vue&type=script&lang=ts& (./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/form/Lexicon.vue?vue&type=script&lang=ts&) 39:0-35
[INFO] Module not found: Error: Can't resolve 'rxjs' in '/home/jan/int-projects/corpus-frontend-fresh/src/frontend/src/pages/search/form'
[INFO]  @ ./src/pages/search/form/Lexicon.vue?vue&type=script&lang=ts& 1:0-259 1:275-278 1:280-536 1:280-536
[INFO]  @ ./src/pages/search/form/Lexicon.vue 2:0-59 3:0-54 3:0-54 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/form/QueryFormSearch.vue?vue&type=script&lang=ts& 22:0-54 35:13-20
[INFO]  @ ./src/pages/search/form/QueryFormSearch.vue?vue&type=script&lang=ts& 1:0-267 1:283-286 1:288-552 1:288-552
[INFO]  @ ./src/pages/search/form/QueryFormSearch.vue 2:0-67 3:0-62 3:0-62 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/form/QueryForm.vue?vue&type=script&lang=ts& 16:0-70 24:21-36
[INFO]  @ ./src/pages/search/form/QueryForm.vue?vue&type=script&lang=ts& 1:0-261 1:277-280 1:282-540 1:282-540
[INFO]  @ ./src/pages/search/form/QueryForm.vue 2:0-61 3:0-56 3:0-56 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/SearchPage.vue?vue&type=script&lang=ts& 5:0-58 11:15-24
[INFO]  @ ./src/pages/search/SearchPage.vue?vue&type=script&lang=ts& 1:0-253 1:269-272 1:274-524 1:274-524
[INFO]  @ ./src/pages/search/SearchPage.vue 2:0-62 3:0-57 3:0-57 9:2-8
[INFO]  @ ./src/search.tsx 36:0-64 253:23-42
[INFO] 
[INFO] ERROR in ./src/pages/search/form/Lexicon.vue?vue&type=script&lang=ts& (./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/form/Lexicon.vue?vue&type=script&lang=ts&) 40:0-101
[INFO] Module not found: Error: Can't resolve 'rxjs/operators' in '/home/jan/int-projects/corpus-frontend-fresh/src/frontend/src/pages/search/form'
[INFO]  @ ./src/pages/search/form/Lexicon.vue?vue&type=script&lang=ts& 1:0-259 1:275-278 1:280-536 1:280-536
[INFO]  @ ./src/pages/search/form/Lexicon.vue 2:0-59 3:0-54 3:0-54 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/form/QueryFormSearch.vue?vue&type=script&lang=ts& 22:0-54 35:13-20
[INFO]  @ ./src/pages/search/form/QueryFormSearch.vue?vue&type=script&lang=ts& 1:0-267 1:283-286 1:288-552 1:288-552
[INFO]  @ ./src/pages/search/form/QueryFormSearch.vue 2:0-67 3:0-62 3:0-62 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/form/QueryForm.vue?vue&type=script&lang=ts& 16:0-70 24:21-36
[INFO]  @ ./src/pages/search/form/QueryForm.vue?vue&type=script&lang=ts& 1:0-261 1:277-280 1:282-540 1:282-540
[INFO]  @ ./src/pages/search/form/QueryForm.vue 2:0-61 3:0-56 3:0-56 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/SearchPage.vue?vue&type=script&lang=ts& 5:0-58 11:15-24
[INFO]  @ ./src/pages/search/SearchPage.vue?vue&type=script&lang=ts& 1:0-253 1:269-272 1:274-524 1:274-524
[INFO]  @ ./src/pages/search/SearchPage.vue 2:0-62 3:0-57 3:0-57 9:2-8
[INFO]  @ ./src/search.tsx 36:0-64 253:23-42
[INFO] 
[INFO] ERROR in ./src/pages/search/results/ResultTotals.vue?vue&type=script&lang=ts& (./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/results/ResultTotals.vue?vue&type=script&lang=ts&) 7:0-37
[INFO] Module not found: Error: Can't resolve 'rxjs' in '/home/jan/int-projects/corpus-frontend-fresh/src/frontend/src/pages/search/results'
[INFO]  @ ./src/pages/search/results/ResultTotals.vue?vue&type=script&lang=ts& 1:0-264 1:280-283 1:285-546 1:285-546
[INFO]  @ ./src/pages/search/results/ResultTotals.vue 2:0-64 3:0-59 3:0-59 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/results/ResultsView.vue?vue&type=script&lang=ts& 56:0-61 70:12-18
[INFO]  @ ./src/pages/search/results/ResultsView.vue?vue&type=script&lang=ts& 1:0-263 1:279-282 1:284-544 1:284-544
[INFO]  @ ./src/pages/search/results/ResultsView.vue 2:0-63 3:0-58 3:0-58 10:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/results/Results.vue?vue&type=script&lang=ts& 2:0-65 6:17-28
[INFO]  @ ./src/pages/search/results/Results.vue?vue&type=script&lang=ts& 1:0-259 1:275-278 1:280-536 1:280-536
[INFO]  @ ./src/pages/search/results/Results.vue 2:0-59 3:0-54 3:0-54 9:2-8
[INFO]  @ ./node_modules/babel-loader/lib/index.js!./node_modules/ts-loader/index.js??clonedRuleSet-4[0].rules[0].use[1]!./node_modules/vue-loader/lib/index.js??vue-loader-options!./src/pages/search/SearchPage.vue?vue&type=script&lang=ts& 7:0-57 13:13-20
[INFO]  @ ./src/pages/search/SearchPage.vue?vue&type=script&lang=ts& 1:0-253 1:269-272 1:274-524 1:274-524
[INFO]  @ ./src/pages/search/SearchPage.vue 2:0-62 3:0-57 3:0-57 9:2-8
[INFO]  @ ./src/search.tsx 36:0-64 253:23-42
...
(lots more errors follow)
KCMertens commented 2 years ago

Should be fixed!

jan-niestadt commented 2 years ago

Yes, it builds succesfully now!

It does still change the package-lock.json (makes a lockfileVersion 1 for some reason and removes a bunch of stuff). I've seen that before, is that just unavoidable with npm projects being worked on by different people? Again, I have node 16.13.2 and npm 8.1.2 installed, but I guess this build uses its own preferred version?

I've read about version pinning using .nvmrc, maybe that could help?