Replit.nix not updating old node.js repl

I have an existing node.js repl that I need to update to a newer version of node.js.

I am trying to use replit.nix to do this. This repl was originally created before repl started using nix.

I have added a replit.nix file with the following contents:

{ pkgs }: {
	deps = [

When I press enter in the shell after editing this, I can see it trying to apply this, as it shows the message “Detected change in environment, reloading shell…”.

However when I print out the node version in my code, it is still coming up with node.js v12.22.10.

I tried the exact same index.js, replit.nix and .replit in a brand new repl and it prints out node.js v16.13.2.

Forking the existing project and deleting files down to the exact same files as the new repl gives me node.js v12.22.10.

Hi there, welcome to the replit community :wave:.

You can either (1) update your repl by running code in the shell or (2) fork a specific repl and copy your code over to there.

Recommended Way

  1. Execute this script on the shell to install node (you can choose the version by editing the number 16) and configure npm.
npm init -y && npm i --save-dev node@16 && npm config set prefix=$(pwd)/node_modules/node && export PATH=$(pwd)/node_modules/node/bin:$PATH`
  1. Create the .replit to execute node from the shell instead of the console.
run="npm start"
  1. Make sure to add the start script in your package.json file
"scripts": {

"start": "node ."

  1. (Optional) If you had packages like canvas or sqlite before, you need to re-install those packages
npm uninstall canvas && npm i canvas

The Other Way

  1. Open the following repl: NodeJS 16 - Nix (beta) Repl - Replit
  2. Clone the repl
  3. Copy and paste any files and content you had on your previous repl, and boom, if everything went good, you should have the latest version!

My thought is that you’ve created a second replit.nix file. Did you show hidden files first? There should already be a replit.nix file in all Repls.


@IanAtReplit I considered this. When I created the replit.nix file, it disappeared when I gave it the extension, and I found it by showing hidden files. I hope there isn’t some sort of second replit.nix doubly hidden under the new hidden one i created.

@KadenBlox The recommended way worked! I don’t know why it worked, and if I remove them it reverts back to v12. But for now it’s working, thank you!


No problem, replit’s machines run weirdly and they are very… (let’s put it as) interesting… machines.

1 Like

To anyone reading in the future:

It appears replit has a template called node.js Latest, I recommend to use that if you are wanting the latest version of node.js on replit. This is probably the best way to make sure your repl is on the latest version.


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