## 08 cannot use import statement outside a module (Node 22.23) # Node 22.23 detects ES module syntax in a package without a type field, so the error needs a CommonJS package ("type": "commonjs") to appear $ node app.js (node:889) Warning: Failed to load the ES module: /tmp/tfs/n8/app.js. Make sure to set "type": "module" in the nearest package.json file or use the .mjs extension. (Use `node --trace-warnings ...` to show where the warning was created) /tmp/tfs/n8/app.js:1 import fs from "fs"; ^^^^^^ [exit ] # answer: set "type": "module" in package.json $ node app.js ran object [exit ] # the answer warns that require() then stops working; checked: $ node b.js [exit ] SyntaxError: Cannot use import statement outside a module