Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incompatibility with Node.js 20 #5984

Closed
4 tasks
VIKTORVAV99 opened this issue Oct 4, 2023 · 3 comments · Fixed by #6055
Closed
4 tasks

Incompatibility with Node.js 20 #5984

VIKTORVAV99 opened this issue Oct 4, 2023 · 3 comments · Fixed by #6055
Assignees

Comments

@VIKTORVAV99
Copy link
Member

Description

It seems like we are incompatible with nodejs 20.

TODO

  • Investigate what the issue is and resolve if possible.
  • Update wiki to make it clear we only support nodejs 18 at the moment.
  • Use .nodeversion files.
  • Reduce version ranges to tested versions in package.json files.
@VIKTORVAV99 VIKTORVAV99 self-assigned this Oct 4, 2023
@travellingprog travellingprog mentioned this issue Oct 26, 2023
1 task
@madsnedergaard
Copy link
Member

I am getting this error now when trying to run the map:

Screenshot 2023-11-03 at 10 20 11

Ran:

  • nvm use 20
  • rm -rf node_modules
  • pnpm install

@madsnedergaard madsnedergaard reopened this Nov 3, 2023
@travellingprog
Copy link
Contributor

@madsnedergaard

The short explanation is that your issue is caused by a Node bug that is not present in the latest Node v20 (at the time of writing, v20.9.0). This is why this issue did not occur in the CI environment If you run nvm install 20, that should get you the latest version. I believe we should also now update the Earthfile to have FROM node:20 rather than FROM node:20.6. FROM node:20-bookworm would also be good if we want to lock in the major Debian version. Let me know what you think.

I was able to reproduce your issue with Node v20.6.1, and was able to see that it got fixed in Node v20.8.0. Looked at the Node changelog and found that this was the commit for the fix: nodejs/node#49655.

Furthermore, there is now a .node-version file in both the web/ and mockserver/ folders. That file only has 20 in it, so that in our CI environment, we always use the latest v20. That file is supported by multiple Node version managers, but unfortunately nvm is still not one of them, despite a long opened issue. I recommend fnm personally. With that tool installed, you can run fnm install in a folder with a .node-version file, and it will always install (if necessary) and use the indicated Node version.

And finally, a quick warning. Once you change to the latest v20, check that pnpm exec node --version and pnpm exec which node output what you expect (that PNPM is using the Node from your version manager). I found out, while trying to reproduce your issue, that I had a global config use-node-version setting that was loading Node from a PNPM environment rather than my fnm version.

@madsnedergaard
Copy link
Member

Oh, thanks for the detailed answer! 🙏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants