持续整理遇到的npm相关问题
1.在使用npm i 时出现的警告,当前的使用的npm版本太高了
The package-lock.json file was created with an old version of npm
解决:
方法一:
安装低版本的npm,在@后面添加你要的版本
npm i npm@6 -g
最后用npm-v检查下当前版本
方法二:
使用nvm切换
查看当前使用的node版本
nvm list
安装所需要的版本(以10.9.0版本为例)
nvm install 10.9.0
切换要使用的版本号
nvm use 10.9.0
2.The term ‘npm’ is not recognized as the name of a cmdlet
在使用npm指令的时候报的错,最后重装node才解决。
3.快速删除node_modules的方法
先安装删除工具
npm install rimraf -g
删除命令
rimraf node_modules