In use
nvs
before it has been usingnvm windows
this tool, with the also very cool, not long ago to see science text, so would like to try, then tried inwindows
a rollover, so here record it. Look at the Popular Science article: Use nvs manage local Node.js version
windows
Under Installation
git bash environment configuration
# ~/.bashrc 添加下面的环境配置
# 根据你安装的路径选择$ProgramData 或者 $LOCALAPPDATA
export NVS_HOME=$LOCALAPPDATA/nvs
. $NVS_HOME/nvs.sh
复制代码
git bash in nvs
error can not find command
nvs v1.5.1
UseMSI
orchoco install nvs
after installation can be used normally, but will be missingnvs.sh
if you aregit bash
under usenvs
will not find the command, subsequent versions will fix the problem. Recommended cmd manual installation step is not the problem.
nvs
And the npm
command does not take effect
After installing the new terminal window
nvs
andnpm
when not to take effect, pay attention to log off again, or reboot the system.
Note: in particular, for the first time nvs link
, and found node
and npm
will not take effect, the best log off again.
Shared npm
global module
First, we do not recommend cross-version of the common global module, unless you know what you're doing.
Popular Science article: Use nvs manage local Node.js version has been introduced for how to set.
# 使用git bash创建
mkdir -p ~/.npm-global
npm config set prefix ~/.npm-global
复制代码
# .bashrc中添加全局模块的路径
# 注意~/.npm-global/ 不是~/.npm-global/bin
# windows 10下没有bin文件夹,所以最好检查下。。。
echo "export PATH=~/.npm-global/:$PATH" >> ~/.bashrc
source ~/.bashrc
复制代码
Note: ( nvs v1.5.1
)
- Pay attention to check the global configuration path module is correct (pit)
cmd
And power shell
lower global module add environment variables
Through the above configuration
git bash
, the global installednpm
normal work of the module, but incmd
orpower shell
will find not find the command, tried to add a system variable , but still does not take effect, put a final issues, the official gave the solution .
# 设置完如果不生效,新开一个命令行窗口尝试(如果不行,注销重新登录)
setx PATH "%PATH%;%USERPROFILE%\.npm-global"
复制代码
After setting: cmder
, cmd
, powershell
, cygwin
all in force
note:
nvs use
It is to change the currentshell
windownode
version, not the global environment (the difference nvm)nvs link
It is changing the global environmentnode
version
reference
Popular Science article: Use nvs manage local Node.js version
VS Code Support - Node Version Switcher