Skip to content

Try our new Crash Courses!

Buy one of our new Crash Courses, now hosted on Podia.

Install package globally – npm

Summary

To install a package globally, enter the following command in your terminal:

npm install -g package-name

Details

To install an npm package globally, you can use the npm install command with a -g flag. For example, if you wanted to install the gatsby-cli package, you would enter the following command in your terminal:

npm install -g gatsby-cli

To list all of your globally installed packages and check that your package was installed correctly, enter the following command in your terminal:

npm list -g --depth 0

Continuing the example above, if you installed gatsby-cli correctly, you should see something similar to the following print out in your terminal (your version number may be different):

├── gatsby-cli@2.6.4

Exercises

There are no exercises for this lesson.

Reference

Downloading and installing packages globally | npm Documentation

Back to: npm Reference > npm Global Packages