分享一些在vue项目中使用npm常用的一些命令

20 阅读1分钟

1.永久切换镜像源

npm config set registry https://registry.npmjs.org

2.临时使用官方源安装

npm install -g pm2 --registry=https://registry.npmjs.org

3.使用npm install 安装npm时出现This is probably not a problem with npm. There is likely additional logging output above.错误
分析可能是因为版本问题(安装新版本或者旧版本),导致有一些缓存
可执行下面的命令,在把之前装的都清空

rm -rf node_modules
rm package-lock.json
npm cache clear --force