Skip to content
← Back to Community
How to update Node.js version
Profile icon
lukenzy

Let's get straight to the point!

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

run = """ curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash export NVM_DIR=\"$HOME/.nvm\" [ -s \"$NVM_DIR/nvm.sh\" ] && \\. \"$NVM_DIR/nvm.sh\" [ -s \"$NVM_DIR/bash_completion\" ] && \\.\"$NVM_DIR/bash_completion\" nvm install 14 node index.js """

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
Profile icon
Johnkengi
Profile icon
JointFastCodewarrior
Profile icon
LgkLegacy
Profile icon
clit
Profile icon
JeshuaYaqui
Profile icon
ElvaGinon2
Profile icon
ConfidentialCode
Profile icon
healson
Profile icon
LeoMarino
Profile icon
Olly0002
Comments
hotnewtop
Profile icon
LoliPolice

its still not working

Profile icon
PiousGaming

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

Profile icon
lukenzy

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

Profile icon
PiousGaming

@lukenzy i already put it

Profile icon
AmazingToons

Thx its Working!

Profile icon
Pro70CraZy

Still not working

Profile icon
TelegramGdrive

thanks

Profile icon
zack-khan

This doesn't seem to work anymore, I am getting this error (when putting the code in a .replit file and pressing run):
TypeError [CLIENT_MISSING_INTENTS]: Valid intents must be provided for the Client. at Client._validateOptions (/home/runner/pastaBot/node_modules/discord.js/src/client/Client.js:544:13) at new Client (/home/runner/pastaBot/node_modules/discord.js/src/client/Client.js:73:10) at Object.<anonymous> (/home/runner/pastaBot/index.js:2:16) at Module._compile (internal/modules/cjs/loader.js:1085:14) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10) at Module.load (internal/modules/cjs/loader.js:950:32) at Function.Module._load (internal/modules/cjs/loader.js:790:12) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:76:12) at internal/main/run_main_module.js:17:47 { [Symbol(code)]: 'CLIENT_MISSING_INTENTS' } exit status 1

Profile icon
InfinityDevTech

@zack-khan

Discord.js coding error.

Profile icon
GingerMcFerren

@zack-khan discord.js has updated. You have to use new code.

Profile icon
DynamicSquid

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

Profile icon
lukenzy

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

Profile icon
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 on my system.
@DynamicSquid

Profile icon
DynamicSquid

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

Profile icon
Highwayman

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