1

I am to install @angular/cli on my Ubuntu 16.04 computer. My node version is v7.10.0 and npm is 5.0.0

I keep getting this error:

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/build'
gyp ERR! System Linux 4.10.0-21-generic
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass
gyp ERR! node -v v7.10.0
gyp ERR! node-gyp -v v3.6.1
gyp ERR! not ok 
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/@angular/cli/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

I also tried the following commands:

npm cache clean --force
sudo npm install -g @angular/cli

Should I manually try and change the permission or ownership using chmod or chown?

5
  • are you getting permission denied with sudo? Commented May 26, 2017 at 10:47
  • 1
    docs.npmjs.com/getting-started/fixing-npm-permissions Commented May 26, 2017 at 10:54
  • @alex-rokabilis Yes Commented May 26, 2017 at 11:50
  • @suraj Tried that too. Commented May 26, 2017 at 11:52
  • Me too here, the same error. This did not help. I tried also this comment 's steps but i am keeping getting the same error. Commented Sep 5, 2017 at 18:15

1 Answer 1

2

I had the same issue. It was related to default npm since I had several instances installed on PC.

Currently you're using

/usr/local/bin/node

Try to find another npm:

whereis npm

In my case I got

npm: /usr/bin/npm /usr/local/bin/npm

Then I tried to use another npm in my installation command:

sudo /usr/bin/npm install -g @angular/cli

And finally installed it.

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.