2

When I try npm install -g @angular/cli I get an error:

npm ERR! path /usr/lib/node_modules/@angular
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@angular'
npm ERR!  { Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/@angular'
npm ERR!   stack: 'Error: EACCES: permission denied, mkdir \'/usr/lib/node_modules/@angular\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/lib/node_modules/@angular' }
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/my_name/.npm/_logs/2017-07-15T16_09_19_320Z-debug.log

Therofore I run sudo npm install -g @angular/cli but I get an error:

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/acorn-dynamic-import/node_modules/acorn):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/acorn/-/acorn-4.0.13.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @types/[email protected] (node_modules/@types/serve-static):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/@types/serve-static/-/serve-static-1.7.31.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/acorn):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/acorn/-/acorn-5.1.1.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: @types/[email protected] (node_modules/@types/minimatch):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: request to https://registry.npmjs.org/@types/minimatch/-/minimatch-2.0.29.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/uuid):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, utime '/home/my_name/dev/angular/angular-cli/node_modules/.staging/uuid-d533788a/lib/bytesToUuid.js'

npm ERR! code EAI_AGAIN
npm ERR! errno EAI_AGAIN
npm ERR! request to https://registry.npmjs.org/@types/source-map/-/source-map-0.5.0.tgz failed, reason: getaddrinfo EAI_AGAIN registry.npmjs.org:443

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/my_name/.npm/_logs/2017-07-15T16_09_46_119Z-debug.log

Why I cannot do it. Recently nothing works.

I use Ubuntu 16.04 lts

3
  • 1
    use sudo npm install Commented Jul 15, 2017 at 16:18
  • Don't use sudo npm install, fix your permissions: docs.npmjs.com/getting-started/fixing-npm-permissions Commented Jul 15, 2017 at 17:24
  • What version of node and npm are you running? You need at least node version 6.10, and npm 3.10. Commented Jul 15, 2017 at 17:36

1 Answer 1

2

Run the command sudo rm -rf ~/.npm to clear npm cache. Then try running the command with sudo npm i @angular/cli again

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.