我知道通过nvm安装后,node的路径在类似于/Users/username/.nvm/v0.10.33/bin/node
下。
但是我的sublimeText中有些插件需要指定node的Path。它们默认的是/usr/local/bin/node
。结果就会出现找不到的情况。
请问如何保证/usr/local/bin/node
能正确执行当前的node版本?
nvm好像没有修改/usr/local/bin/node指定到当前的版本,所以我们手动创建一个软连接吧:
ln -s /Users/#{username}/.nvm/#{nodeVersion}/bin/node /usr/local/bin/node
如果你切换版本,也记得更新下这个软链接。
大家讲道理2017-04-17 11:27:47
Using n doesn't have this problem, it modifies /usr/local/bin/node
.
If you must use nvm, you can consider setting the node path for those plug-ins. Changing it to $HOME/node_modules/.bin/node
should be enough.
迷茫2017-04-17 11:27:47
Go to the official website to install the package or use brew to install node
Use nvm only when you want to use the specified version of node