Ask coding questions

← Back to all posts
How to change node version
mirzabhakti

Im trying to build a discord bot recently. I tried to install the new discord.js version but i need to change the node version to 12 or higher. Tried to use this code on my package.json but doesnt work

is there any other way to change the node version?

Answered by Coder100 [earned 5 cycles]
View Answer
Voters
mirzabhakti
Comments
hotnewtop
Coder100

You can install it.
Hit ctrl+shift+s:

What you are looking for is npm as well, so:

isn't that just beautiful :D
and for your package.json:

mirzabhakti

@Coder100 while i tried to install, it gave me an error

Coder100

@mirzabhakti oh delete the node_modules file lol

mirzabhakti

@Coder100 can you show me the way to delete the node_modules? lol

Coder100

um send repl @mirzabhakti

Coder100

usually it's as easy as:

and/or

@mirzabhakti

mirzabhakti

@Coder100 oh that worked thank you. I kinda new to coding so i dont really know the commands & stuff are lol

Coder100

lol np :) @mirzabhakti

CoffeeGuy

@Coder100 thx a lot for this, but is there any way, I can specify the version of node here? :)

karlhorky

@Coder100 this is great, thanks!

We are using this for Preflight, documented our whole journey getting top-level await and other new JavaScript / ES features running in repl.it here:

https://github.com/upleveled/preflight/issues/17

Coder100

no problem :D @karlhorky

Coder100

sorry for the late reply, but

where <version> is the version you would like. It can also be latest, beta, and alpha assuming those are actual builds lol
@CoffeeGuy

SomeGuy19

@Coder100 um it says rm: cannot remove 'node_modules': Is a directory when i type rm node_modules how do I delete the node modules folder??

Coder100

rm -r node_modules @SomeGuy19

[deleted]

Try to use npm i [email protected]