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. 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.
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.
| Runtime | require("@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.0Module format by version
Derived from the type, main and exports fields of every stable release on npm (41 versions; the newest 41 shown).
| Versions | Format | First published |
|---|---|---|
| 2.0.0 – 2.4.0 | ESM-only | Aug 25, 2025 |
| 0.4.2 – 1.8.0 | Dual (CommonJS + ESM) | Dec 3, 2021 |
| 0.4.0 – 0.4.1 | CommonJS | Nov 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
- 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
- @smithy/credential-provider-imds 4.5.2CommonJS
- @smithy/middleware-serde 4.5.2CommonJS
- @aws-sdk/nested-clients 3.997.44Dual
- @smithy/url-parser 4.5.2CommonJS
- @tailwindcss/oxide 4.3.3CommonJS
- @smithy/middleware-stack 4.5.2CommonJS
- @testing-library/dom 10.4.1CommonJS
- @csstools/css-tokenizer 4.0.0ESM-only