Failed to set default version of nvm

  node.js, question

My question:

I usenvmTo manage myNodeJSVersion, want to set its default version, but the setting is invalid.

My code:

I went to the internet to find it and can use it.Nvm alias default <node version number >To set, but the setting is invalid.

Code Run Results:

node -v     // v0.12.4
 nvm alias default v4.2.4    // default -> v4.2.4
 Node -v // is still v0.12.4

Related screenshots


Related attempt

The method I found online can be usedNvm use <node version >To specifynodeHowever, it needs to be set up every time a new window is opened, which is very troublesome and sometimes forgotten.

Another way is to create one in the root directory of the system..nvmrcAnd then write in itNode use <node version >In this way, every time a new window is opened, the file will be accessed and adjusted.nodeThe use version of. But it is not very good to read online.

So let’s ask if there is a better way.

You use itnvm alias default v4.2.4After that, toNew terminal, running node -vWill it take effect?

In fact, you usenvmIf so, each time the terminal is opened, it will be read first.defaultWhat is the default version of, and then call.
If you set up at the same terminal firstdefaultHowever, without reloading the new environment variable, the original will still be usednodeVersion

This is like, you installed a new software in/usr/local/binBelow, but without reloading the environment variable, it will not take effect