npm_0">nvm下载的node没有npm
相信大家最近可能发现自己使用的nvm下载nodejs没有npm了。
会出现这种情况:
C:\Users\89121>nvm install 15
Downloading node.js version 15.14.0 (64-bit)...
Complete
Downloading npm version 7.7.6... Download failed. Rolling Back.
C:\Users\89121\AppData\Roaming\nvm\temp\npm-v7.7.6.zip
Rollback failed. remove C:\Users\89121\AppData\Roaming\nvm\temp\npm-v7.7.6.zip: The process cannot access the file because it is being used by another process.
Could not download npm for node v15.14.0.
Please visit https://github.com/npm/cli/releases/tag/v7.7.6 to download npm.
It should be extracted to C:\Users\89121\AppData\Roaming\nvm\v15.14.0C:\Users\89121>nvm ls* 18.20.1 (Currently using 64-bit executable)15.14.0C:\Users\89121>nvm use 15
Now using node v15.14.0 (64-bit)C:\Users\89121>npm -v
'npm' 不是内部或外部命令,也不是可运行的程序
或批处理文件。
去网上找发现都是让手动下载npm的,这显然是不可能的。其实解决办法很简单,那就是之前配置的淘宝镜像已经废弃了,需要重新配置。
1. 首先打开nvm安装的地方
如果忘记了,可以使用 where nvm 来查看
2. 修改配置文件 setting.txt
将原来的修改成新的:
node_mirror: https://npmmirror.com/mirrors/node/
npm_mirror: https://npmmirror.com/mirrors/npm/
我们卸载了重新安装node,发现npm也已经安装好了。