刪除緩存
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 (查看當(dāng)前鏡像)
yarn
yarn config set registry https://registry.npmjs.org
yarn config set registry https://registry.npm.taobao.org
yarn config get registry
代理設(shè)置取消
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
常見問題:
多個(gè)版本的包會(huì)導(dǎo)致應(yīng)用的不同部分在使用不同的 Vue 與對(duì)應(yīng)包實(shí)例,進(jìn)而引發(fā)如?useXXX() is called without provider?之類的錯(cuò)誤。
你可以通過執(zhí)行下列命令來更新到最新版本
pnpm dlx vp-update
yarn dlx vp-update
npx vp-update