canirequire

canirequireESM-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. 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 you can require() on every Node.js version, including 18 and older, is 1.8.0, published Apr 21, 2025.

require("@noble/hashes") failed in our probe on Node.js 20+ as well. See the runtime matrix below for the exact error.

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

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
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: root module cannot be imported: import submodules instead. Check out README
Node.js 20✗ failsError: root module cannot be imported: import submodules instead. Check out README✗ failsError: root module cannot be imported: import submodules instead. Check out README
Node.js 22✗ failsError: root module cannot be imported: import submodules instead. Check out README✗ failsError: root module cannot be imported: import submodules instead. Check out README
Node.js 24✗ failsError: root module cannot be imported: import submodules instead. Check out README✗ failsError: root module cannot be imported: import submodules instead. Check out README
Node.js 26✗ failsError: root module cannot be imported: import submodules instead. Check out README✗ failsError: root module cannot be imported: import submodules instead. Check out README
Bun 1.4✗ failserror: root module cannot be imported: import submodules instead. Check out README✗ failserror: root module cannot be imported: import submodules instead. Check out README

How to import @noble/hashes

ES modules (import)

import hashes from "@noble/hashes";

CommonJS (require)

// Node.js 20.19+ / 22.12+ / newer (package has no top-level await):
const hashes = require("@noble/hashes");

// Any Node.js version:
const hashes = await import("@noble/hashes");

// Or pin the last CommonJS release:
// 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 (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 you can require() on every Node.js version, including 18 and older, is 1.8.0, published Apr 21, 2025.

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

1.8.0 is the last version of @noble/hashes with a CommonJS build. 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?

Use a dynamic import: const mod = await import("@noble/hashes"). On Node.js 20.19+, 22.12+ and newer, a plain require("@noble/hashes") also works for ESM packages that do not use top-level await. Alternatively pin @noble/hashes@1.8.0.

Does @noble/hashes work in Bun?

Importing @noble/hashes failed in Bun 1.4 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