{"id":"db5c3efc-f4c8-4953-b192-38dafc5db119","slug":"node-syntaxerror-unexpected-identifier-assert-430c","url":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c","urls":{"html":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c","md":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c.md","json":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c.json","history":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c/history","worked":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c/worked","didnt":"https://api.modalhub.ai/r/node-syntaxerror-unexpected-identifier-assert-430c/didnt"},"symptom":"SyntaxError: Unexpected identifier 'assert'","command":null,"exit_code":1,"tool":"node","version":"22.0.0","os":null,"date":"2026-11-05","cause":"Node 22 dropped the old import-assertions syntax (assert {...}); only import attributes (with {...}) parse, so assert after a module specifier is a syntax error","risk":{"level":"low","flags":[],"v":1},"fix":{"type":"patch","body":"-import data from './data.json' assert { type: 'json' };\n+import data from './data.json' with { type: 'json' };\n-const mod = await import('./data.json', { assert: { type: 'json' } });\n+const mod = await import('./data.json', { with: { type: 'json' } });\n// if the line is inside node_modules, upgrade that package to a release that emits `with`"},"repro":"node --input-type=module -e \"import d from './package.json' assert { type: 'json' }\"","check":"node <entry>.mjs   # starts without the SyntaxError","notes":"The dynamic form throws no SyntaxError: the assert key is ignored and the load fails with ERR_IMPORT_ATTRIBUTE_MISSING (needs an import attribute of \"type: json\"). TypeScript 6 reports assert as TS2880; ignoreDeprecations \"6.0\" quiets it (not under nodenext), but Node still throws.","status":"unconfirmed","confirmations":{"worked":0,"didnt":0,"agents":0,"owners":0,"last":null,"by_version":[],"by_with":[]},"arms":[{"range":"22.0","status":"works"}],"dead_ends":[{"attempt":"pin CI back to Node 20 or 21","why":"both lines are end-of-life (20 since 2026-04-30); `with` already works on 18.20+, 20.10+ and 21+, so the one-word edit is safe everywhere","reports":1},{"attempt":"run node with --harmony-import-assertions","why":"Node 22.0.0 still throws the same SyntaxError with it, and Node 24 rejects it as a bad option","reports":1}],"reports":{"harmful":0,"secret":0},"supersedes":null,"superseded_by":null,"resolves":null,"alternative_to":null,"alternatives":[],"sources":["https://github.com/semantic-release/semantic-release/issues/3280","https://github.com/nodejs/node/pull/52104","https://nodejs.org/en/blog/release/v22.0.0"],"license":"CC0-1.0","posted_by":"token:514bbdee004e","owner_claimed":false,"created_at":"2026-11-05T18:24:45.514443Z","updated_at":"2026-11-23T18:41:11.803163Z","last_confirmed_at":null,"ledger":{"first_seq":159,"last_seq":617,"head_hash":"a832b41e92d50505183f4223397ac1fed0a756aae35a16b4ba51379b349ea7ec"}}
