Nono.MA

[Solved] SyntaxError: Cannot use import statement outside a module

OCTOBER 18, 2021

I found the following error while trying to execute PORT=4444 node ./bin/server.js on my Node.js application.

SyntaxError: Cannot use import statement outside a module

I solved it by adding the following into the package.json file of my NPM project.

  "type": "module",

CodeErrorJsNode