nvmTo manage my
NodeJSVersion, want to set its default version, but the setting is invalid.
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
The method I found online can be used
Nvm use <node version >To specify
nodeHowever, 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 it
Node 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 it
nvm alias default v4.2.4After that, to
New terminal, running node -vWill it take effect?
In fact, you use
nvmIf 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 first
defaultHowever, without reloading the new environment variable, the original will still be used
This is like, you installed a new software in
/usr/local/binBelow, but without reloading the environment variable, it will not take effect