我只是想安装一个
shadcn
包,却遇到了这个极其奇怪的错误:
ERR_PNPM_RECURSIVE_EXEC_FIRST_FAIL Command "cache" not found
node:internal/modules/cjs/loader:1275
const err = new Error(`Cannot find module '${request}'`);
^
Error: Cannot find module '/Users/XXX/Library/Caches/pnpm/dlx/hx67qbkz3shxeflxwe2je2aqw4/193af67f081-15278/node_modules/.pnpm/@[email protected]/node_modules/@jridgewell/gen-mapping/dist/gen-mapping.umd.js'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:1275:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:1264:15)
at resolveExports (node:internal/modules/cjs/loader:638:14)
at Function._findPath (node:internal/modules/cjs/loader:737:31)
at Function._resolveFilename (node:internal/modules/cjs/loader:1225:27)
at Function._load (node:internal/modules/cjs/loader:1064:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:218:24)
at Module.require (node:internal/modules/cjs/loader:1325:12)
at require (node:internal/modules/helpers:136:16) {
code: 'MODULE_NOT_FOUND',
path: '/Users/XXX/Library/Caches/pnpm/dlx/hx67qbkz3shxeflxwe2je2aqw4/193af67f081-15278/node_modules/.pnpm/@[email protected]/node_modules/@jridgewell/gen-mapping'
}
Node.js v23.3.0
仅供参考,这是我尝试运行的导致此错误的命令:
pnpm dlx shadcn@latest add accordion
我尝试运行这些命令来解决这个问题:
pnpm store prune
rm -rf node_modules pnpm-lock.yaml
pnpm install
我还尝试手动添加错误引用的包,我尝试将其添加为开发依赖项和常规包,其中:
pnpm add @jridgewell/gen-mapping
pnpm add -D @jridgewell/gen-mapping
我尝试过的任何方法似乎都不起作用,因此任何帮助都将非常感激!
这个问题似乎是最近才出现的。几个小时前我在这篇文章中遇到了同样的问题。
错误报告已提交到 shadcn/ui github 存储库: