Mac错误:/ bin / sh:npm:找不到命令

时间:2019-09-27 20:16:58

标签: node.js macos makefile cmake

我正在尝试构建c ++项目,并看到以下错误: 你能看看吗?

/bin/sh: npm: command not found
make[2]: *** [modules/GUI/CMakeFiles/Client] Error 127
make[1]: *** [modules/GUI/CMakeFiles/Client.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

我关注了这个维基:sudo: npm: command not found 但这对我不起作用。

For MAC users, the follow steps worked for me, the error still there.

$ brew update
$ brew uninstall node
$ brew install node
$ brew postinstall 

1 个答案:

答案 0 :(得分:0)

您看到this吗?

您是否尝试过:brew doctor

您会得到什么:

which node
which npm

如果您为node买了东西,请寻找路径,看看附近有什么。

最坏的情况是,如果您没有向brew添加任何其他内容,请考虑删除brew并重新安装。

仅供参考:对于我来说,使用nvm可以看到:

➜  ~ which npm
/Users/pgkehle/.nvm/versions/node/v11.15.0/bin/npm
➜  ~ which node
/Users/pgkehle/.nvm/versions/node/v11.15.0/bin/node

您的路径会有所不同,但是可以考虑使用nvm