我已经使用nvm文档安装了node/npm.
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.29.0/install.sh | bash
Run Code Online (Sandbox Code Playgroud)
然后:
nvm install node
Run Code Online (Sandbox Code Playgroud)
此时节点正在运行,但是npm命令结果为:
npm: command not found
Run Code Online (Sandbox Code Playgroud)
我怎样才能让npm正常工作?
Rap*_*aël 24
我发现这是与以前的npm版本的冲突,尽管有一个没有被正确删除apt-get remove node.
我通过从头重新安装npm来解决它:
rm -R ~/.npm ~/.nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
nvm install node
Run Code Online (Sandbox Code Playgroud)
我在这里找到了解决方案.
我通过卸载所有有问题的节点版本(例如下面的 v14)并重新安装来解决它。
问题:
node --version; npm --version;
Run Code Online (Sandbox Code Playgroud)
v14.17.1
Command 'npm' not found, but can be installed with:
sudo apt install npm
Run Code Online (Sandbox Code Playgroud)
解决方案:
v14.17.1
Command 'npm' not found, but can be installed with:
sudo apt install npm
Run Code Online (Sandbox Code Playgroud)
此问题尤其发生在 Windows 中,这是由于缺少 cmd 的管理员权限而发生的。
如果您使用的是 Git bash
Cmd 也是如此
| 归档时间: |
|
| 查看次数: |
16344 次 |
| 最近记录: |