I recently realised that one of my npm packages require Node v20 and higher, and running node -v
on a Node.js shell returns v18.12.1
.
How can I use the latest version of Node?
I recently realised that one of my npm packages require Node v20 and higher, and running node -v
on a Node.js shell returns v18.12.1
.
How can I use the latest version of Node?
Try to update the replit.nix
file with the version of Node that you want to use.
add/change the modules
entry in the .replit
file
modules = ["nodejs-20:v8-20230920-bd784b9"]
Adding both of these things and running node -v
in the shell returns v20.3.1.
But I get many evaluating file (filename) messages and this error at the bottom:
Detected change in environment, reloading shell...
nix error: building nix env: exit status 1
Output has been trimmed to the last 20 lines
[...]
evaluating file '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/lib/systems/doubles.nix'
copied source '/nix/store/l6smcclpy9f3v562q2ljb9zjdswg3ma1-nixpkgs-22.11-src/pkgs/stdenv/generic/default-builder.sh' -> '/nix/store/9krlzvny65gdc8s7kpb6lkx8cd02c25b-default-builder.sh'
error: attribute 'nodejs_20_x' missing, at /home/runner/Discourse-WelcomeBot/replit.nix:3:3
no need to add anything to replit.nix
I just tried that, and it’s still node v18
Maybe I’ll just have to wait until Replit updates the Node template to v20
try npm install -g node@20
remove nodejs 18 from replit.nix
if it exists. And ensure that you hit enter in Shell so it reloads the nix env, before using node
.
AFAIK, that should fail, since you wouldn’t have perms for a “global” installation.
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.