skip to Main Content

I was just trying to install a shadcn package and was met with this extremely strange error:

 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

For reference, this was the command I tried to run that caused this error:

pnpm dlx shadcn@latest add accordion

I tried to run these commands to remedy this:

pnpm store prune
rm -rf node_modules pnpm-lock.yaml
pnpm install

I also tried to manually add the package that the error made reference to, I tried to both add it as a dev-dependency, and as a regular package, with:

pnpm add @jridgewell/gen-mapping
pnpm add -D @jridgewell/gen-mapping

Nothing I tried seemed to do the trick, so any help would be greatly appreciated!

5

Answers


  1. The issue appears to be recent. I’m having the same issue as of a few hours ago from this post.

    A bug report has already been submitted to the shadcn/ui github repository:

    https://github.com/shadcn-ui/ui/issues/6026

    Login or Signup to reply.
  2. fixed it by downgrading manually using
    npm i @jridgewell/[email protected] –force

    Login or Signup to reply.
  3. This issue doesn’t seem to be related ot shadcn-ui. I think the npm package @jridgewell/gen-mapping broke something.

    First delete your package-lock.json and your node_modules folder. Then install version 0.3.4 of the package and afterwards just do an npm install again.

    npm i @jridgewell/[email protected] –force

    Should be working then, for me it fixed the problem!

    Login or Signup to reply.
  4. The problem is caused by the build failure of the newly published version 0.3.6.snapshot

    You can force install the last version for fix it by command npm i -f @jridgewell/[email protected].

    Login or Signup to reply.
  5. The package management tool I use is yarn, and I configured resolutions in package.json to solve the problem,

    "resolutions": {
        "@jridgewell/gen-mapping": "0.3.3"
      }
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search