js
7 verified fixes Node.js errors
Reproduced on pinned Node images, fixed and re-checked.
7 errors
- Cannot use import statement outside a module
Cannot use import statement outside a module の直し方(Node.js)
node:20-alpine · import in CommonJSNode でファイルを実行したら、import の行で次のエラーが出て止まることがあります。
Node.js 4 min read - ERR_OSSL_EVP_UNSUPPORTED
digital envelope routines::unsupported の直し方(Node.js の ERR_OSSL_EVP_UNSUPPORTED)
node:18-alpine · webpack 4 / CRA · OpenSSL 3 hashingnpm run build(webpack、Create React App、vue-cli、Angular など)が、次のエラーで突然落ちるようになったら、原因はほぼ確実に Node のバージョンを上げたことです。
Node.js 5 min read - ERR_REQUIRE_ASYNC_MODULE
require() cannot be used on an ESM graph with top-level await の直し方(Node.js の ERR_REQUIRE_ASYNC_MODULE)
node:22 · require() of top-level await ESMNode を新しめのバージョンに上げたあと、CommonJS から ESM を require() すると次のエラーで落ちることがあります。
Node.js 3 min read - ERR_REQUIRE_ESM
require() of ES Module not supported の直し方(Node.js の ERR_REQUIRE_ESM)
node:18-alpine · require() in CommonJSCommonJS(.cjs や require() を使うコード)から ESM 専用モジュールを読み込もうとすると、次のエラーで落ちます。
Node.js 3 min read - ERR_UNKNOWN_FILE_EXTENSION
Unknown file extension ".ts" の直し方(Node.js で TypeScript を直接実行したとき)
node:22.6.0-alpine · node app.ts (no loader)node app.ts のように TypeScript ファイルを Node で直接実行しようとして、次のエラーで止まることがあります。
Node.js 3 min read - Named export not found
does not provide an export named / Named export not found の直し方(Node.js)
node:20-alpine · named import from CommonJSES Module(ESM)から名前付き import をしたら、次のどちらかのエラーで止まることがあります。
Node.js 3 min read - require is not defined in ES module scope
require is not defined in ES module scope の直し方(Node.js)
node:20-alpine · require() in an ESM fileNode で .js を実行したら、次のエラーで落ちることがあります。
Node.js 4 min read
条件に一致するエラーはありません。フィルタを緩めてください。