# Is @humanfs/node ESM-only? Can you require() it?

> @humanfs/node@0.16.8 is ESM-only. ESM-only — it has never shipped a CommonJS build.

The Node.js bindings of the humanfs library.

Last verified Sep 9, 2026 against @humanfs/node@0.16.8.

@humanfs/node has been ESM-only since its first stable release; there is no CommonJS version to pin.

require("@humanfs/node") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. On Node.js 18, which has no require(esm), require("@humanfs/node") fails with ERR_REQUIRE_ESM.

## What to do

1. require("@humanfs/node") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.
2. From a CommonJS file, use a dynamic import inside an async function: const node = await import("@humanfs/node"). That works on every Node.js version the package supports (>=18.18.0).
3. There is no CommonJS release of @humanfs/node to pin; without require(esm) the only option is a dynamic import().
4. TypeScript: types are bundled; install nothing extra.

## Facts

- Latest: 0.16.8 (Apr 17, 2026)
- Module format: ESM-only
- Last CommonJS version: none
- ESM-only since: 0.7.0 (Jan 30, 2024)
- TypeScript types: bundled
- Node engines: >=18.18.0
- Weekly downloads: 94.4M
- License: Apache-2.0

## Runtime test results for @humanfs/node@0.16.8

Installed and executed on Sep 9, 2026 with require("@humanfs/node") from a CommonJS file and import "@humanfs/node" from an ES module.

| Runtime | require("@humanfs/node") | import "@humanfs/node" |
|---|---|---|
| Node.js 18 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 20 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 22 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 24 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Node.js 26 | fails (ERR_PACKAGE_PATH_NOT_EXPORTED) | works |
| Bun 1.4.0 | fails (Error) | works |

## How to import @humanfs/node

ES modules:

```js
import * as node from "@humanfs/node";
```

Namespace import shown because the ESM entry may have no default export; use named imports for what it exports.

CommonJS:

```js
// require("@humanfs/node") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (ERR_PACKAGE_PATH_NOT_EXPORTED); see the runtime table.

// Any Node.js version the package supports (>=18.18.0), from an async function:
async function main() {
  const node = await import("@humanfs/node");
}
```

## Module format by version

Derived from the type, main and exports fields of every stable release on npm (19 versions; the newest 19 shown).

| Versions | Format | First published |
|---|---|---|
| 0.7.0 – 0.16.8 | ESM-only | Jan 30, 2024 |

## Frequently asked

**Is @humanfs/node ESM-only?**

@humanfs/node@0.16.8 is ESM-only. @humanfs/node has been ESM-only since its first stable release; there is no CommonJS version to pin.

**Which version of @humanfs/node still supports CommonJS / require()?**

None. @humanfs/node has always been ESM-only. Use import, or a dynamic import("@humanfs/node") from an async function in CommonJS.

**How do I use @humanfs/node from a CommonJS file?**

From a CommonJS file, use a dynamic import inside an async function: const node = await import("@humanfs/node"). That works on every Node.js version the package supports (>=18.18.0). require("@humanfs/node") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it.

**Does @humanfs/node work in Bun?**

Yes. import "@humanfs/node" loaded successfully in Bun 1.4.0 on Sep 9, 2026.

**Does @humanfs/node ship TypeScript types?**

Yes. @humanfs/node bundles its own type declarations; no @types package is needed.

## Links

- [@humanfs/node on npm](https://www.npmjs.com/package/@humanfs/node)
- [Source repository](https://github.com/humanwhocodes/humanfs)
- [HTML version](https://canirequire.com/package/@humanfs/node/)
- [JSON version](https://canirequire.com/package/@humanfs/node.json)

---

For scripts and AI agents: any package is at https://canirequire.com/package/<name>/index.md (Markdown) or https://canirequire.com/package/<name>.json (JSON); the site index is https://canirequire.com/llms.txt. Fetch the URL directly; no search needed.
