canirequire

canirequire › ESM-only › @noble/hashes

Is @noble/hashes ESM-only? Can you require() it?

Audited & minimal 0-dependency JS implementation of SHA, RIPEMD, BLAKE, HMAC, HKDF, PBKDF & Scrypt

Last verified Sep 9, 2026 against @noble/hashes@2.4.0. Markdown · JSON

ESM-only ESM-only since 2.0.0 — last CommonJS version is 1.8.0

@noble/hashes dropped its CommonJS build in 2.0.0 (August 2025). The last version with a plain require()-able CommonJS entry is 1.8.0, published Apr 21, 2025; it declares support for Node.js ^14.21.3 || >=16.

require("@noble/hashes") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Node.js 18 has no require(esm), and @noble/hashes@2.4.0 declares Node.js >= 20.19.0, so 18 is outside its supported range anyway.

@noble/hashes@2.4.0 declares engines ">= 20.19.0", so Node.js 18 is outside its supported range regardless of module format.

What to do

  1. require("@noble/hashes") 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 hashes = await import("@noble/hashes"). That works on every Node.js version the package supports (>= 20.19.0).
  3. If you need a synchronous require() or run Node.js 18: npm install @noble/hashes@1.8.0, the last CommonJS release (published Apr 21, 2025); it declares Node.js ^14.21.3 || >=16.
  4. @noble/hashes@2.4.0 declares engines ">= 20.19.0", so Node.js 18 is unsupported regardless: upgrade Node.js or pin an older release.
  5. TypeScript: types are bundled; install nothing extra.
Latest
2.4.0 (Aug 27, 2026)
Module format
ESM-only
Last CommonJS version
1.8.0
ESM-only since
2.0.0 (Aug 25, 2025)
TypeScript types
Bundled
Node engines
>= 20.19.0
Weekly downloads
63.5M
License
MIT

Does @noble/hashes@2.4.0 actually load? Runtime test results

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

Runtimerequire("@noble/hashes")import "@noble/hashes"
Node.js 18✗ failsERR_REQUIRE_ESM✗ failsError
Node.js 20✗ failsError✗ failsError
Node.js 22✗ failsError✗ failsError
Node.js 24✗ failsError✗ failsError
Node.js 26✗ failsError✗ failsError
Bun 1.4.0✗ failsError✗ failsError

How to import @noble/hashes

ES modules (import)

import * as hashes from "@noble/hashes";

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

CommonJS (require)

// require("@noble/hashes") failed in our probe on Node.js 20.19+, 22.12+ and newer as well (root module cannot be imported: import submodules instead. Check out README); see the runtime table.

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

// Or pin the last CommonJS release (declares Node.js ^14.21.3 || >=16):
// npm install @noble/hashes@1.8.0

Module format by version

Derived from the type, main and exports fields of every stable release on npm, corrected where a runtime test of that version contradicted them (41 versions; the newest 41 shown).

VersionsFormatFirst published
2.0.0 – 2.4.0ESM-onlyAug 25, 2025
0.4.2 – 1.8.0Dual (CommonJS + ESM)Dec 3, 2021
0.4.0 – 0.4.1CommonJSNov 7, 2021

Frequently asked

Is @noble/hashes ESM-only?

@noble/hashes@2.4.0 is ESM-only. @noble/hashes dropped its CommonJS build in 2.0.0 (August 2025). The last version with a plain require()-able CommonJS entry is 1.8.0, published Apr 21, 2025; it declares support for Node.js ^14.21.3 || >=16.

Which version of @noble/hashes still supports CommonJS / require()?

1.8.0 is the last version of @noble/hashes with a CommonJS build; it declares Node.js ^14.21.3 || >=16. Install it with "npm install @noble/hashes@1.8.0". Every version from 2.0.0 on is ESM-only.

How do I use @noble/hashes from a CommonJS file?

From a CommonJS file, use a dynamic import inside an async function: const hashes = await import("@noble/hashes"). That works on every Node.js version the package supports (>= 20.19.0). require("@noble/hashes") failed in our probe on Node.js 20+ as well; see the runtime table for the error before relying on it. Alternatively pin @noble/hashes@1.8.0 (declares Node.js ^14.21.3 || >=16).

Does @noble/hashes work in Bun?

Importing @noble/hashes failed in Bun 1.4.0 on Sep 9, 2026: error: root module cannot be imported: import submodules instead. Check out README

Does @noble/hashes ship TypeScript types?

Yes. @noble/hashes bundles its own type declarations; no @types package is needed.

Links

Other esm-only packages

Similar popularity