我只是想安装一个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
我尝试过的所有方法似乎都没有效果,因此我将非常感激任何帮助!