Array
University of Oregon

NPM Global Packages

When you use npm to install a package globally (with -g or –global), npm uses a global directory on your computer. The directory npm uses by default is owned by your system, not by your user account.

Therefore, the install may not succeed due to permission and ownership problems (which is another reason for developers to learn how to use shell commands like chmod and chown).

To avoid potential problems we will configure npm to use your home directory for global installs.

In class, we will go through the steps described under, Option 2: Change npm’s default directory to another directory, with one change: Where the instructions refer to “.profile”, substitute “.bash_profile”.

If you missed the class in which we covered these steps, go to office hours for assistance. Do this before installing any global packages (like Zeit Now, Surge, etc.)

Skip to toolbar