已安装节点,但未安装 NPM

Node installed, but not NPM

我用 brew 'brew install node' 安装了 node,我收到一条警告消息

'Warning: The post-install step did not complete successfully'.

当我输入 node -v 时,我确实可以看到当前的 node 版本,但是当我试图找到当前的 npm 版本时,我得到了这个错误。

-bash: /usr/local/bin/npm: No such file or directory

NPM 不存在的原因是因为post-安装步骤没有成功完成吗?

是的,那件事也发生在我身上。经过大量搜索后,我找到了解决方案。我想这会对你有所帮助。

sudo brew uninstall node
brew update
brew upgrade
brew cleanup
brew install node
sudo chown -R myusername /usr/local
brew link --overwrite node
sudo brew postinstall node

谢谢!!