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
- Use import data from './data.json' with { type: 'json' }
- Or read with fs and JSON.parse
- Or createRequire for CommonJS-style require
Detailed fix by platform
Node.js
import config from './config.json' with { type: 'json' };
How to diagnose
- Import — How is the JSON imported?
- 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:
Similar errors
Most viewed in Node.js
Other ways to find it
Where this error sits
Origin: Application & API. Errors that are often confused with or caused by this one (click to open):
🧠 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.
Did this fix work for you?
Report a correction or suggest an improvement
Last updated 12 Oct 2026