NPM

To install NPM, simply install Node.js.

Commands

Install

  • without arguments

    This component was made by Stratis Dermanoutsos. The code can be found here.

    Running npm install without arguments installs modules defined in the dependencies section of the package.json file.

  • with arguments

    This component was made by Stratis Dermanoutsos. The code can be found here.
  • Options

    • (with —global)

      This component was made by Stratis Dermanoutsos. The code can be found here.

      When run with —global or -g, npm install installs the package globally. This means the package is installed in two places. The first is at the root directory where package.json is defined. The second is the global node_modules folder on the user system.

    • (with —save)

      This component was made by Stratis Dermanoutsos. The code can be found here.

      When run with —save, npm install modifies the package.json file to include the specified package as a dependency. In this case, the express package will be added as a dependency to package.json.

    • (with —save-dev)

      The —save-dev flag specifies that the package should be added to the devDependencies section of the package.json rather than the dependencies section.

    • (with —production)

      This component was made by Stratis Dermanoutsos. The code can be found here.

      The —production flag specifies to exclude devDependencies from the install. This means any dependency listed under the devDependencies section of package.json won’t get installed when this flag is present.

Uninstall

This component was made by Stratis Dermanoutsos. The code can be found here.

List installed packages

This component was made by Stratis Dermanoutsos. The code can be found here.

Update (global) packages

This component was made by Stratis Dermanoutsos. The code can be found here.

Update NPM

This component was made by Stratis Dermanoutsos. The code can be found here.

Fix issues (for example, when you move a project to another machine)

This component was made by Stratis Dermanoutsos. The code can be found here.

Resources