You can list what packages are installed globally in your system with
npm -g list—shorthand for
npm --global list—whereas you'd list the packages installed in an NPM project with
Let's see an example of what the command might return.
npm -g list # /opt/homebrew/lib # ├── firstname.lastname@example.org # ├── email@example.com # ├── firstname.lastname@example.org # ├── email@example.com # ├── firstname.lastname@example.org # ├── email@example.com # ├── firstname.lastname@example.org # └── email@example.com
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.