npm包删除善后
1.安装npm包–rimraf
npm install rimraf -g
2.在cmd指令下,进入所需删除的node_modules文件夹的位置,再输入指令
rimraf node_modules
3.简单粗暴得秒删完成
清理缓存
npm cache clear --force
yarn cache clean
rimraf node_modules && npm cache clear --force
package.json中设置
{
"scripts": {
"dev": "vue-cli-service serve",
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint",
"clean": "rimraf node_modules && npm cache clear --force && npm install",
"reinstall": "npm run clean && npm install"
},
}
之后直接用npm run clean 删除即可。
每次npm install都特别慢,然后也看不到进度,同时还经常容易报错,推荐使用yarn或pnpm来管理包,比npm好用。
npm设置淘宝源
npm config set registry https://registry.npm.taobao.org
yarn的安装
npm install -g yarn
yarn config get registry
yarn config set registry https://registry.npm.taobao.org/
pnpm的安装
npm install -g pnpm
# 查看源
pnpm config get registry
# 设置淘宝源
pnpm config set registry https://registry.npm.taobao.org/
恢复官方源
yarn config set registry https://registry.yarnpkg.com
npm config set registry https://registry.npmjs.org
|