search

Home  >  Q&A  >  body text

node.js - 使用nvm后/usr/local/bin/node找不到

我知道通过nvm安装后,node的路径在类似于/Users/username/.nvm/v0.10.33/bin/node下。

但是我的sublimeText中有些插件需要指定node的Path。它们默认的是/usr/local/bin/node。结果就会出现找不到的情况。

请问如何保证/usr/local/bin/node能正确执行当前的node版本?


2014-11-25 17:08:41 Update

nvm好像没有修改/usr/local/bin/node指定到当前的版本,所以我们手动创建一个软连接吧:

ln -s /Users/#{username}/.nvm/#{nodeVersion}/bin/node /usr/local/bin/node

如果你切换版本,也记得更新下这个软链接。

PHPzPHPz2787 days ago664

reply all(2)I'll reply

  • 大家讲道理

    大家讲道理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.

    reply
    0
  • 迷茫

    迷茫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

    reply
    0
  • Cancelreply