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.
nodemon is a tool that helps develop Node.js based applications by automatically restarting the node application when file changes in the directory are detected.
How to install it globally?
npm install -g nodemon
Then you can use it anywhere as
nodemon script.js and, every time
script.js changes, the execution will restart with the new code, avoiding repetitive calls to
node script.js, for instance.