canirequire › ESM-only › pnpm
Is pnpm ESM-only? Can you require() it?
Fast, disk space efficient package manager
Last verified Sep 9, 2026 against pnpm@12.3.4. JSON
ESM-only ESM-only since 12.0.0 — last CommonJS version is 11.26.0
pnpm dropped its CommonJS build in 12.0.0 (August 2026). The last version you can require() on every Node.js version, including 18 and older, is 11.26.0, published Sep 6, 2026.
require("pnpm") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.
Does pnpm@12.3.4 actually load? Runtime test results
Installed and executed on Sep 9, 2026 with require("pnpm") from a CommonJS file and import "pnpm" from an ES module.
| Runtime | require("pnpm") | import "pnpm" |
|---|---|---|
| Node.js 18 | ✗ failsMODULE_NOT_FOUND | ✗ failsERR_MODULE_NOT_FOUND |
| Node.js 20 | ✗ failsMODULE_NOT_FOUND | ✗ failsERR_MODULE_NOT_FOUND |
| Node.js 22 | ✗ failsMODULE_NOT_FOUND | ✗ failsERR_MODULE_NOT_FOUND |
| Node.js 24 | ✗ failsMODULE_NOT_FOUND | ✗ failsERR_MODULE_NOT_FOUND |
| Node.js 26 | ✗ failsMODULE_NOT_FOUND | ✗ failsERR_MODULE_NOT_FOUND |
| Bun 1.4 | ✗ failserror: Cannot find package 'pnpm' from '/Users/boat/Projects/top-seo/data/probe-work/pnpm/req.cjs' | ✗ failserror: Cannot find package 'pnpm' from '/Users/boat/Projects/top-seo/data/probe-work/pnpm/imp.mjs' |
How to import pnpm
ES modules (import)
import pnpm from "pnpm";CommonJS (require)
// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const pnpm = require("pnpm");
// Any Node.js version:
const pnpm = await import("pnpm");
// Or pin the last CommonJS release:
// npm install pnpm@11.26.0Module format by version
Derived from the type, main and exports fields of every stable release on npm (980 versions; the newest 60 shown).
| Versions | Format | First published |
|---|---|---|
| 12.0.0 – 12.4.0 | ESM-only | Aug 26, 2026 |
| 10.34.2 – 11.26.0 | CommonJS | Jun 10, 2026 |
Frequently asked
Is pnpm ESM-only?
pnpm@12.3.4 is ESM-only. pnpm dropped its CommonJS build in 12.0.0 (August 2026). The last version you can require() on every Node.js version, including 18 and older, is 11.26.0, published Sep 6, 2026.
Which version of pnpm still supports CommonJS / require()?
11.26.0 is the last version of pnpm with a CommonJS build. Install it with "npm install pnpm@11.26.0". Every version from 12.0.0 on is ESM-only.
How do I use pnpm from a CommonJS file?
Use a dynamic import: const mod = await import("pnpm"). On Node.js 20.19+, 22.12+ and newer, a plain require("pnpm") also works for ESM packages that do not use top-level await. Alternatively pin pnpm@11.26.0.
Does pnpm work in Bun?
Importing pnpm failed in Bun 1.4 on Sep 9, 2026: error: Cannot find package 'pnpm' from '/Users/boat/Projects/top-seo/data/probe-work/pnpm/imp.mjs'
Does pnpm ship TypeScript types?
No. pnpm ships no type declarations and there is no @types package for it.
Links
Other esm-only packages
- ansi-styles 7.0.0last CJS
5.2.0 - strip-ansi 7.2.0last CJS
6.0.1 - commander 15.0.0last CJS
14.0.3 - supports-color 11.0.0last CJS
8.1.1 - chalk 6.0.0last CJS
4.1.2 - tslib 2.8.1last CJS
2.5.2 - string-width 8.2.2last CJS
4.2.3 - ansi-regex 6.3.0last CJS
5.0.1
Similar popularity
- qs 6.16.0CommonJS
- node-releases 2.0.55ESM-only
- onetime 8.0.0ESM-only
- fdir 6.5.0Dual
- estree-walker 3.0.3Dual
- is-extglob 2.1.1CommonJS
- jsesc 3.1.0CommonJS
- vite 8.2.2ESM-only