最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

brew install npm“npm:command not found”

IT培训 admin 5浏览 0评论

brew install npm“npm:command not found”

我使用brew install node安装了节点,当我使用node -v时,我得到了v5.0.0。但是,当我尝试运行npm命令时,我得到了npm: command not found

我试图运行brew install npm,但我只是得到以下响应node-5.0.0 already installed

它发生在节点也返回命令未找到,但我通过运行brew link node修复,但是npm仍然似乎不起作用。

我该如何解决这个问题?

回答如下:

您需要确保设置了$NODE_PATH环境变量:

# Add this to your ~/.bash_profile file:
export NODE_PATH="/usr/local/lib/node_modules"

您还可以尝试以下方法:

运行以下命令以删除所有现有的全局npm模块,卸载node&npm,使用正确的默认值重新安装节点,将npm安装为自己的pacakge,并配置要安装的全局npm模块的位置。

rm -rf /usr/local/lib/node_modules brew uninstall node brew install node --without-npm echo prefix=~/.node >> ~/.npmrc curl -L https://www.npmjs/install.sh | sh

圣洁:https://gist.github/DanHerbert/9520689

brew install npm“npm:command not found”

我使用brew install node安装了节点,当我使用node -v时,我得到了v5.0.0。但是,当我尝试运行npm命令时,我得到了npm: command not found

我试图运行brew install npm,但我只是得到以下响应node-5.0.0 already installed

它发生在节点也返回命令未找到,但我通过运行brew link node修复,但是npm仍然似乎不起作用。

我该如何解决这个问题?

回答如下:

您需要确保设置了$NODE_PATH环境变量:

# Add this to your ~/.bash_profile file:
export NODE_PATH="/usr/local/lib/node_modules"

您还可以尝试以下方法:

运行以下命令以删除所有现有的全局npm模块,卸载node&npm,使用正确的默认值重新安装节点,将npm安装为自己的pacakge,并配置要安装的全局npm模块的位置。

rm -rf /usr/local/lib/node_modules brew uninstall node brew install node --without-npm echo prefix=~/.node >> ~/.npmrc curl -L https://www.npmjs/install.sh | sh

圣洁:https://gist.github/DanHerbert/9520689

发布评论

评论列表 (0)

  1. 暂无评论