NUMde / compass-numapp-web

NUM COMPASS web app
MIT License
0 stars 0 forks source link

Cannot run the app #7

Closed mbastian93 closed 2 years ago

mbastian93 commented 2 years ago

Describe the bug The app does not run when executing npm run dev, instead it crashes with the following output:

[ ERROR ] Node Polyfills Required For the import "crypto" to be bundled from ./node_modules/node-forge/lib/pbkdf2.js, ensure the "rollup-plugin-node-polyfills" plugin is installed and added to the stencil config plugins (client). Please see the bundling docs for more information. Further information: https://stenciljs.com/docs/module-bundling

[ ERROR ] Node Polyfills Required For the import "crypto" to be bundled from ./node_modules/node-forge/lib/prng.js, ensure the "rollup-plugin-node-polyfills" plugin is installed and added to the stencil config plugins (client). Please see the bundling docs for more information. Further information: https://stenciljs.com/docs/module-bundling

[ ERROR ] Node Polyfills Required For the import "crypto" to be bundled from ./node_modules/node-forge/lib/rsa.js, ensure the "rollup-plugin-node-polyfills" plugin is installed and added to the stencil config plugins (client). Please see the bundling docs for more information. Further information: https://stenciljs.com/docs/module-bundling

[ ERROR ] Node Polyfills Required "rollup-plugin-node-polyfills" plugin is installed and added to the stencil config plugins (client). Please see the bundling docs for more information. Further information: https://stenciljs.com/docs/module-bundling

[ WARN ] Bundling Warning UNRESOLVED_IMPORT 'crypto' is imported by ./node_modules/node-forge/lib/pbkdf2.js, but could not be resolved – treating it as an external dependency

[ WARN ] Bundling Warning UNRESOLVED_IMPORT 'crypto' is imported by ./node_modules/node-forge/lib/prng.js, but could not be resolved – treating it as an external dependency

[ WARN ] Bundling Warning UNRESOLVED_IMPORT 'crypto' is imported by ./node_modules/node-forge/lib/rsa.js, but could not be resolved – treating it as an external dependency

[ WARN ] Bundling Warning UNRESOLVED_IMPORT 'crypto' is imported by crypto?commonjs-external, but could not be resolved – treating it as an external dependency

[35:27.1] build failed, watching for changes... in 6.72 s

To Reproduce Steps to reproduce the behavior:

  1. Clone the project
  2. run npm ci
  3. run npm run dev

Expected behavior The app should run

Screenshots -

Additional context

mbastian93 commented 2 years ago

I'm not sure if that's the root of the problem, but back at work i tried to run it again on a MacBook where it failed because the webapp itself "only" needs node > 14 but the dependency "@d4l/web-components-library" needs node > 15 and i was using node 14.

After installing node v16, it works as expected.

jonathan-reisdorf commented 2 years ago

Thank you @mbastian93 for the hint, I'll align the node version to be > 15. The node-crypto dependency comes from the node-forge module, which is used when encrypting the questionnaire response, and for some reason it seems to not have installed when you ran npm ci with node 14 in your case. I'll try to reproduce. But it's great to hear that it works with node 16 for you!

jonathan-reisdorf commented 2 years ago

I couldn't reproduce the issue with npm 7.22.0 and node 14.15.4 w/ Linux. For me, the build works just fine with node 14 (despite the node compat warning), which lets me question if we really need to bump the node version to > 15 instead of lowering the node version of @d4l/web-components-library. I'll test with Windows 10 later.

jonathan-reisdorf commented 2 years ago

I reproduced the issue on Windows both with node 14 as well as v16. It turns out that the version of the node-resolve rollup plugin that stencil uses is outdated and leads to the error. Manually updating to a newer version and loading it before the builtin stencil plugin is loaded resolves the build issue on Windows. I'll add a PR later today.