Updating NodeJS to the highest version replit supports

i been needing to update my nodejs repl to the highest nodejs version replit supports and i dont know how to update nodejs does it currently runs node 18.18.2

The node version that replit is using right now is 20.10.0 which is superior to the version you said. You can check what node version is running in your repl by using node -v command
image

how do i update node to 20.10.0 though

If you create a new node.js template that will come with the newest version.
If you want to update an old template, you can edit the replit.nix file with the version you desire.

pkgs.nodejs-20_x

Screenshot 2024-01-10 1.46.09 PM
Screenshot 2024-01-10 1.47.43 PM

now its not allowing the repl to boot at all no error i guess lag idk

Can you paste the contents of your replit.nix file?

entrypoint = "index.js"
modules = ["nodejs-20:v8-20230920-bd784b9"]
hidden = [".config", "package-lock.json"]
run = "node --trace-warnings index"
[nix]
channel = "stable-23_05"

[deployment]
run = ["node", "index.js"]
deploymentTarget = "cloudrun"
ignorePorts = false

oh wait woops wrong file

{ pkgs }: {
  deps = [
pkgs.nodejs-20_x
  ];
}

code: ‘ERR_DLOPEN_FAILED’

Oooh you are updating an old template…
You will need to update the dependencies too

You have to update your package.json file to support the v20 and after that delete the node_modules folder and the package-lock.json file from your project.

Then you can run npm install to reinstall all your dependencies.

Or you just create a new project and copy the code from your old one.

1 Like

Depending on which library you were using you will probably need to refactore your code so keep that in mind.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.