TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///path/package.json" needs an import assertion of type "json"
at new NodeError (node:internal/errors:400:5)
at validateAssertions (node:internal/modules/esm/assert:82:15)
at defaultLoad (node:internal/modules/esm/load:84:3)
at nextLoad (node:internal/modules/esm/loader:163:28)
at ESMLoader.load (node:internal/modules/esm/loader:605:26)
at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22)
at new ModuleJob (node:internal/modules/esm/module_job:64:26)
at #createModuleJob (node:internal/modules/esm/loader:480:17)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34)
at async ModuleWrap. (node:internal/modules/esm/module_job:79:21) {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
Just trying to start nodejs -> express application with yarn start.
1) scripts: "start": "node server.js"
NodeJS introduced asserting when importing json based files. But... package.json is auto imported.
Do you need to assert that?
node:internal/errors:491 ErrorCaptureStackTrace(err); ^
TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]: Module "file:///path/package.json" needs an import assertion of type "json" at new NodeError (node:internal/errors:400:5) at validateAssertions (node:internal/modules/esm/assert:82:15) at defaultLoad (node:internal/modules/esm/load:84:3) at nextLoad (node:internal/modules/esm/loader:163:28) at ESMLoader.load (node:internal/modules/esm/loader:605:26) at ESMLoader.moduleProvider (node:internal/modules/esm/loader:457:22) at new ModuleJob (node:internal/modules/esm/module_job:64:26) at #createModuleJob (node:internal/modules/esm/loader:480:17) at ESMLoader.getModuleJob (node:internal/modules/esm/loader:434:34) at async ModuleWrap. (node:internal/modules/esm/module_job:79:21) {
code: 'ERR_IMPORT_ASSERTION_TYPE_MISSING'
}
Node.js v18.13.0