Learn to Code via Tutorials on Repl.it!

← Back to all posts
How to update Node.js version
lukenzy

Let's get straight to the point!

Create a file and name it .replit
Inside it, copy and paste the following code:

This will install and use the latest Node.js v14 (14.17.4).
If u want to use a different version, change nvm install 14 to any other number.

Also, change node index.js to the file u want to run.

Well, that's it!
More info: https://www.digitalocean.com/community/tutorials/nodejs-node-version-manager

Voters
LeoMarino
Olly0002
WillianAugusto
Aidanwilliams7
iAzozzi
MohidMirza
lukenzy
Comments
hotnewtop
PiousGaming

I already install but when i type node -v it still node v12.22.1 how can i fix it ?


lukenzy

@PiousGaming Instead of updating Node in Shell, try putting code in the .replit file.

PiousGaming

@lukenzy i already put it

LoliPolice

its still not working

DynamicSquid

What does curl -o- <URL> | bash do?

lukenzy

@DynamicSquid Tbh I have never worked with Linux, I just found the solution to my problem and wanted to share it with everyone.

Highwayman

- is commonly used to reference either stdin or stdout in the cli if I remember correctly, that's what I've seen a lot. -o is most likely the flag for indicating the file to which the response is supposed to be sent, then curl's output(stdout, which contains the response now) is piped to bash, which is, of course, a shell, where it is interpreted assumedly.

So, basically, curl -o- <URL> | bash is saying "run the bash file at <URL> on my system.
@DynamicSquid

DynamicSquid

@Highwayman Okay, that makes more sense. I thought -o- was it's own symbol lol. Thanks!

Highwayman

tbh it actually looked like an emote to me for a second there lol XP
yw :) @DynamicSquid