Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I set the default Node.js version with nvm? [duplicate]

I'm using nvm to manage my Node.js versions. In my projects, I have .nvmrc files in the project root. When I run nvm use, I get the Node.js version needed for the project.

This is all working great, but when I open up a new console window, at first I always have a very old Node.js version set automatically.

Running node -v gives me 6.9.5.

What's really annoying is that my IDE (IntelliJ IDEA) runs pre-commit hooks when I use its VCS commit dialog using this old Node.js version, which makes unit tests and the commit fail.

How can I make it so that a specific version of Node.js is set as default?

like image 722
Patrick Hund Avatar asked Dec 06 '25 19:12

Patrick Hund


1 Answers

You can use the command nvm alias to set the default version you would like to use, for example:

nvm install 10.17.0
nvm alias default 10.17.0
like image 181
Patrick Hund Avatar answered Dec 08 '25 14:12

Patrick Hund



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!