ERR_IMPORT_ATTRIBUTE_MISSING Node.js Origin: Application & API Last updated 12 Oct 2026

TypeError [ERR_IMPORT_ATTRIBUTE_MISSING]: Module needs an import attribute of "type: json"

An ES module imported a .json file without the required import attribute.

Exact message you may see needs an import attribute of "type: json"
Seen on: Node.js

Meaning

Native ESM requires with { type: 'json' } (older Node: assert { type: 'json' }) when importing JSON.

Common causes

  • import data from './data.json' without attributes
  • Older code using assert syntax on newer Node

⚡ Quick fix

  1. Use import data from './data.json' with { type: 'json' }
  2. Or read with fs and JSON.parse
  3. Or createRequire for CommonJS-style require

Detailed fix by platform

Node.js

  1. import config from './config.json' with { type: 'json' };

How to diagnose

  1. Import — How is the JSON imported?
  2. Node — Version?

🔧 Still not fixed?

Many errors look alike. If the steps above didn’t solve it, one of these is probably what you’re facing:

Where this error sits

Origin: Application & API. Errors that are often confused with or caused by this one (click to open):

DEP0005 — DeprecationWarning: Buffer() is deprecated due to security and usability issues (DEP0005) (Node.js)DEP0005ERR_PACKAGE_PATH_NOT_EXPORTED — Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './x' is not defined by "exports" (Node.js)ERR_PACKAGE_PATH_NOT_…ERR_REQUIRE_ESM — Error [ERR_REQUIRE_ESM]: require() of ES Module not supported (Node.js)ERR_REQUIRE_ESMERR_UNKNOWN_FILE_EXTENSION — TypeError [ERR_UNKNOWN_FILE_EXTENSION]: Unknown file extension ".ts" (Node.js)ERR_UNKNOWN_FILE_EXTE…Jest ESM — Jest: SyntaxError: Cannot use import statement outside a module (Jest encountered an unexpected token) (React)Jest ESMMODULE_NOT_FOUND — Error: Cannot find module 'x' (MODULE_NOT_FOUND) (Node.js)MODULE_NOT_FOUNDSyntaxError import — SyntaxError: Cannot use import statement outside a module (Node.js)SyntaxError importERR_IMPOR…

Explore the map of this error Full error map →

🧠 Still stuck? Analyze your error

Paste the full message, response headers or stack trace — we'll detect the platform and point to the most likely cause.

💬 What worked for others

No tips yet — did something else fix this for you?

Share what worked for you

Tips are checked by an editor before they appear. Links are removed.