Skip to content

Error: Cannot find module ... 'pnpm.cjs' when using pnpm 12 in Volta v1.1.1 on macOS #2114

Description

@shirakaba

When trying to use pnpm 12 installed via Volta v1.1.1 on macOS Tahoe 26.7, it looks for a pnpm.cjs file that is not present.

# Install pnpm 12 via Volta
volta install pnpm@12.4.2              
success: installed and set pnpm@12.4.2 as default

# Try running a `pnpm install` in my repo:
pnpm install --no-frozen-lockfile     
node:internal/modules/cjs/loader:1459
  throw err;
  ^

Error: Cannot find module '/Users/jamie/.volta/tools/image/pnpm/12.4.2/bin/pnpm.cjs'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1456:15)
    at defaultResolveImpl (node:internal/modules/cjs/loader:1066:19)
    at resolveForCJSWithHooks (node:internal/modules/cjs/loader:1071:22)
    at Module._load (node:internal/modules/cjs/loader:1242:25)
    at wrapModuleLoad (node:internal/modules/cjs/loader:255:19)
    at Module.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:154:5)
    at node:internal/main/run_main_module:33:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Activity

  1. shirakaba commented on Sep 18, 2026

    @shirakaba
    Author

    Workaround

    Copy the following pnpm.cjs file into the expected location, ~/.volta/tools/image/pnpm/12.4.2/bin/pnpm.cjs:

    #!/usr/bin/env node
    // CommonJS shim for compatibility with older Corepack versions
    import('./pnpm.mjs')

    pnpm install worked successfully for me after that.

    The story behind the file

    I found this file provided with pnpm v11.18.0, and it looked version-agnostic, so I tried it out, and indeed it worked for pnpm v12.

  2. changed the title [-]Error: Cannot find module ... 'pnpm.cjs' when using pnpm 12[/-] [+]Error: Cannot find module ... 'pnpm.cjs' when using pnpm 12 in Volta v1.1.1 on macOS[/+] on Sep 18, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions