删除缓存
npm cache clean --force
yarn cache clean
pnpm store prune
镜像切换
npm
npm config set registry https://registry.npm.taobao.org ( 切换淘宝镜像)
npm config set registry https://registry.npmjs.org (换回来)
npm config get registry (查看当前镜像)
yarn
yarn config set registry https://registry.npmjs.org
yarn config set registry https://registry.npm.taobao.org
yarn config get registry
代理设置取消
npm
npm config set proxy=http://127.0.0.1:8087
npm config set https-proxy=http://127.0.0.1:8087
npm config delete proxy
npm config delete https-proxy
yarn
yarn config set proxy http://XXX
yarn config set https-proxy http://XXX
yarn config delete proxy
yarn config delete https-proxy
查看yarn安装包的本地路径
yarn global dir
npm全局安装目录
一般是安装在了 C:\Users\Administrator\AppData\Roaming\npm
常见问题:
多个版本的包会导致应用的不同部分在使用不同的 Vue 与对应包实例,进而引发如 useXXX() is called without provider 之类的错误。
你可以通过执行下列命令来更新到最新版本
pnpm dlx vp-update
yarn dlx vp-update
npx vp-update