npm's problem

How to Prevent Permissions Errors

How to Prevent Permissions Errors

  1. Back-up your computer before you start.

  2. Make a directory for global installations:

    1
    mkdir ~/.npm-global
  3. Configure npm to use the new directory path:

    1
    npm config set prefix '~/.npm-global'
  4. Open or create a ~/.bashrc file and add this line:

    1
    export PATH=~/.npm-global/bin:$PATH
  5. Back on the command line, update your system variables:

    1
    source ~/.profile
  6. Test: Download a package globally without using sudo.

    1
    npm install -g jshint