SyntaxError: Cannot use import statement outside a module – How to fix this error in Node.js?
SyntaxError: Cannot use import statement outside a module – This error occurs when you use ES6 imports in your node.js code.
Advertisements
To fix this just add “type”: “module” to your package.json file.
{ . . "type": "module" . . }