2

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?

Patrick Hund
  • 17,059
  • 10
  • 61
  • 91
  • Ah, damn, I didn't find this when I was searching Stack Overflow, now I've created a duplicate. Thanks for pointing it out. – Patrick Hund Nov 20 '19 at 08:50

1 Answers1

10

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
Penny Liu
  • 11,885
  • 5
  • 66
  • 81
Patrick Hund
  • 17,059
  • 10
  • 61
  • 91
  • Do you mean `nvm install 10.17.0`? – Evi Song Feb 27 '20 at 03:30
  • 5
    When I run "nvm alias default 10.17.0", it just gives me a list of available options... it just doesn't seem to do anything (and my "ng -v" continues to use the wrong, older, version of node.js) Has something changed with nvm ? – Mike Gledhill Mar 27 '20 at 10:12