SyntaxError: Cannot use import statement outside a module - This error occurs when you use ES6 imports in your node.js code. To fix this just add "type": "module" to your package.json file.

Read more of this post