window10系统上安装nodejs版本管理工具:
1、下载nvm:https://github.com/coreybutler/nvm-windows/releases
我下载的是 1.1.6版本中的 nvm-setup.zip
2、解压缩,运行nvm-setup.exe,选择nvm安装路径,下一步选择node安装路径(第一次安装我选择的默认安装路径),依次点击完成
3、cmd运行nvm -v 查看是否安装成功,然后安装node版本,nvm install v7.6.0,会依次安装node和相应的npm版本,最后运行 nvm use 7.6.0,显示切换成功,但是 运行 node -v,却依旧没有切换成功
解决方案:
在安装nvm之前我系统上已经安装了一版node,需要卸载node,发现还是不成功,最后在https://github.com/coreybutler/nvm-windows/issues/321 找到了答案,解决方案如下:
重命名node安装目录:Renamed "C:\Program Files\nodejs" to "C:\Program Files\nodejsx",
Then from an elevated cmd called "nvm use 8.9.1" (any version you got should work..) and it started to work.
Problem seems to be if nodejs directory exists, nvm can not change it to a symlink and 'fails silently' would be nice with a fail and an error message stating the problem.
网友评论