DEV Community

Cover image for Updating Node.js to 16+ in Replit

Updating Node.js to 16+ in Replit

Arnav Kumar on August 21, 2021

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 t...
Collapse
 
vonheikemen profile image
Heiker

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
Collapse
 
rajnishanand profile image
Rajnish Anand

Nicely Explained ✨

Collapse
 
arnavkr profile image
Arnav Kumar

Thanks 😃

Collapse
 
kingisawesome profile image
kingisawesome

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?

Collapse
 
arnavkr profile image
Arnav Kumar

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

Collapse
 
kingisawesome profile image
kingisawesome • Edited

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

Thread Thread
 
arnavkr profile image
Arnav Kumar

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

Collapse
 
arnavkr profile image
Arnav Kumar

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

Collapse
 
insidiousthedev profile image
Insidious

Glad I found this!

Collapse
 
anurag90tech profile image
Anurag Saikia

Awesome code Bro... Love from Sololearn ❣️

Collapse
 
arnavkr profile image
Arnav Kumar

ThankU 😀