title: npm ERR! code EACCESS by installing @angular/cli
body: <p>Environment:</p>
  
  <ul>
  <li>Ubuntu 16.04</li>
  <li>node v8.11.1 (installed with package manager)</li>
  <li>npm  v5.6.0</li>
  </ul>
  
  <p>After the clean installation of npm and trying to install @angular/cli </p>
  
  <pre><code>npm install -g @angular/cli
  </code></pre>
  
  <p>I'm getting an error related with EACCESS that it is probably related with permissions because it disappears with root access. The thing is that it is not recommended to use it that way, so how could I solve this?</p>
  
  <p><strong>Console ERROR</strong></p>
  
  <pre><code>$ npm install -g @angular/cli
  npm WARN checkPermissions Missing write access to /usr/lib/node_modules
  npm ERR! path /usr/lib/node_modules
  npm ERR! code EACCES
  npm ERR! errno -13
  npm ERR! syscall access
  npm ERR! Error: EACCES: permission denied, access '/usr/lib/node_modules'
  npm ERR!  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
  npm ERR!   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
  npm ERR!   errno: -13,
  npm ERR!   code: 'EACCES',
  npm ERR!   syscall: 'access',
  npm ERR!   path: '/usr/lib/node_modules' }
  npm ERR! 
  npm ERR! Please try running this command again as root/Administrator.
  
  npm ERR! A complete log of this run can be found in:
  npm ERR!     /home/user/.npm/_logs/2018-04-25T15_23_36_781Z-debug.log
  </code></pre>
  
  <p><strong>File .npm/_logs/2018-04-25T15_23_36_781Z-debug.log</strong></p>
  
  <pre><code>2566 warn checkPermissions Missing write access to /usr/lib/node_modules
  2567 verbose stack Error: EACCES: permission denied, access '/usr/lib/node_modules'
  2568 verbose cwd /opt/workspace/roscam-front
  2569 verbose Linux 2.6.32-042stab120.19
  2570 verbose argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "@angular/cli"
  2571 verbose node v8.11.1
  2572 verbose npm  v5.6.0
  2573 error path /usr/lib/node_modules
  2574 error code EACCES
  2575 error errno -13
  2576 error syscall access
  2577 error Error: EACCES: permission denied, access '/usr/lib/node_modules'
  2577 error  { Error: EACCES: permission denied, access '/usr/lib/node_modules'
  2577 error   stack: 'Error: EACCES: permission denied, access \'/usr/lib/node_modules\'',
  2577 error   errno: -13,
  2577 error   code: 'EACCES',
  2577 error   syscall: 'access',
  2577 error   path: '/usr/lib/node_modules' }
  2578 error Please try running this command again as root/Administrator.
  2579 verbose exit [ -13, true ]
  </code></pre>