Updating Node.js to 16+ in Replit
Arnav Kumar

Arnav Kumar @arnavkr

About: A Full-Stack Web Developer, UI/UX designer, Cryptography, Cybersecurity Lover

Location:
India
Joined:
Jan 18, 2021

Updating Node.js to 16+ in Replit

Publish Date: Aug 21 '21
17 11

Hey There,
Welcome to my first post, today i'll tell you how can you update your Replit's Nodejs version to 16+, so lets get started.

Many want to do that as to support Discord's latest v13 as it would only run on Nodejs v16.6 or higher. But there maybe your own reasons (Nobody likes old versions 😅).

Here's our repl at version 12.x.x after this tutorial it will be updated to 16+
Unupdated Repl

At first go to your repl or if you don't have any just create one.

Go to the shell prompt and run the following code

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
Enter fullscreen mode Exit fullscreen mode

Shell with code

After running the code you would see the following output:

Shell after Run

And congo 🎉 your repl's nodejs has been successfully updated to 16+.
You could further confirm it by running node -v in the shell

Success

Update: There's another better way to do this now just use the Node 16 template while creating the repl
https://replit.com/@RoBlockHead/NodeJS-16

Comments 11 total

  • Rajnish Anand
    Rajnish AnandAug 21, 2021

    Nicely Explained ✨

  • Heiker
    HeikerAug 21, 2021

    Nice post.

    I always forget node is an npm package.

    One could also use the .replit file to reference the node version inside node_modules.

    run = "node_modules/.bin/node index.js"
    
    Enter fullscreen mode Exit fullscreen mode
  • Anurag Saikia
    Anurag SaikiaSep 3, 2021

    Awesome code Bro... Love from Sololearn ❣️

  • kingisawesome
    kingisawesomeSep 26, 2021

    Hi! Nice post and nice solution. My problem is every time I close my replit and open it again, the node version goes back to 12+ and I have to manually update it to 16+ again. Is there a solution to permanently upgrade node.js to +16 in my own repl?

    • Arnav Kumar
      Arnav KumarSep 26, 2021

      How do you check your version

      Do you see in console panel or the shell one

      The console will always show 12 even if its originally 16

      The more reliable way to check is node -v

      • kingisawesome
        kingisawesomeSep 26, 2021

        I use the shell, and yes I use node -v and it shows version 12 after I update to 16 whenever the repl.it closes so I manually do the command everytime

        • Arnav Kumar
          Arnav KumarSep 28, 2021

          Ig replit has changed in a while.
          When i was writing the post i myself tried reopening the repl to see whether it still there or not and it was there but it doesn't happen.

          A hackey solution to this would be installing node everytime you run the repl 😅

          Ik it sounds strange but it may work maybe

          You can try putting that code in replit run script

    • Arnav Kumar
      Arnav KumarNov 14, 2021

      Hey there i have updated the post

      Now u can use the Node 16 template while creating a repl in replit

      Here's the template
      replit.com/@RoBlockHead/NodeJS-16

  • Insidious
    InsidiousNov 17, 2021

    Glad I found this!

Add comment