NPM is the default package manager for Node.js, allowing developers to share and manage project dependencies.

Global versus Local Packages

Local packages are project-specific, global packages are system-wide.

  • Local packages are installed in the node_modules folder of the directory where you ran npm install <package-name>.
    • Prefer to install packages locally.
  • Global packages are all put in a single place in your system, regardless of where you run npm install -g <package-name>.
    • Install packages globally when it provides an command-line tool or utility that’s reused across projects. (e.g. create-react-app, nodemon)