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.
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 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.
Was this page helpful?
Report a correction or suggest an improvement
Last updated 2 Oct 2026