背景
ERR_PNPM_UNEXPECTED_STORE Unexpected store location
The dependencies at "C:\Users\acer\Code\Nuxt3\init\node_modules" are currently linked from the store at "C:\Users\acer\.hvigor\caches\v3".
pnpm now wants to use the store at "C:\Users\acer\AppData\Local\pnpm\global\5\.pnpm\v3" to link dependencies.
If you want to use the new store location, reinstall your dependencies with "pnpm install".
You may change the global store location by running "pnpm config set store-dir <dir> --global".
(This error may happen if the node_modules was installed with a different major version of pnpm)
如图
解决
说实话看到这玩意我一头雾水,于是马上就借助搜索引擎去了,甚至没看这段英文写了什么。
但是没有有用的回答,比较接近这个问题的是这篇:https://stackoverflow.com/questions/72196681/err-pnpm-err-pnpm-unexpected-pkg-content-in-store-the-lockfile-is-broken-a-full
于是看了一下报错写了什么。
大概的意思就是,你当前设置的存储库不是pnpm想要的,因此你需要设置他指出的那个存储库
。
比较有趣的是,这个.hvigor是之前华为deveco项目留下来的,现在ide都卸载了。
- 执行命令
pnpm config set store-dir <dir> --global
这个<dir>
替换成他提示那个就行。
例如
pnpm config set store-dir C:\Users\acer\AppData\Local\pnpm\global\5\.pnpm\v3 --global
pnpm i
显示以下提示,输入y确认即可。
√ The modules directory at "C:\Users\acer\Code\Nuxt3\init\node_modules" will be removed and reinstalled from scratch. Proceed? (Y/n)
结语
确实是像他提示那样操作就行,过于简单以至于网络上都找不到答案。
标签:UNEXPECTED,Users,ERR,global,location,pnpm,acer,store From: https://www.cnblogs.com/oldsaltfish/p/18306070