angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

Installation error: permission denied for node-sas

Open macliems opened this issue 9 years ago • 35 comments

Installation error (node-sass) with:

node version 8.1.2 npm version 5.0.3

I recently updated node from 7.5.0 to 8.1.2 (with nvm). Installing the latest @angular/cli now results in this error:

The log given by the failure.

> [email protected] install /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/install.js

Unable to save binary /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/vendor/darwin-x64-57 : { Error: EACCES: permission denied, mkdir '/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/vendor'
    at Object.fs.mkdirSync (fs.js:890:18)
    at sync (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/scripts/install.js:111:11)
    at Object.<anonymous> (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/scripts/install.js:154:1)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/vendor' }

> [email protected] install /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/fsevents
> node install

[fsevents] Success: "/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> [email protected] postinstall /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass
> node scripts/build.js

Building: /Users/macliems/.nvm/versions/node/v8.1.2/bin/node /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/Users/macliems/.nvm/versions/node/v8.1.2/bin/node',
gyp verb cli   '/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:13:12)\n    at F (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:68:19)\n    at E (/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:80:29)\n    at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/which/which.js:89:16\n    at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/isexe/index.js:42:5\n    at /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import platform; print(platform.python_version());"` returned: "2.7.10\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.1.2
gyp verb command install [ '8.1.2' ]
gyp verb install input version string "8.1.2"
gyp verb install installing version: 8.1.2
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.1.2
gyp verb build dir attempting to create "build" dir: /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/build
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass/build'
gyp ERR! System Darwin 16.6.0
gyp ERR! command "/Users/macliems/.nvm/versions/node/v8.1.2/bin/node" "/Users/macliems/.nvm/versions/node/v8.1.2/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 /Users/macliems/.nvm/versions/node/v8.1.2/lib/node_modules/@angular/cli/node_modules/node-sass
gyp ERR! node -v v8.1.2
gyp ERR! node-gyp -v v3.6.2
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

macliems avatar Jun 30 '17 08:06 macliems

May want to check out #6800

jiverson avatar Jun 30 '17 15:06 jiverson

Agreed, check out: https://docs.npmjs.com/getting-started/fixing-npm-permissions

ddimaria avatar Jul 10 '17 06:07 ddimaria

Closing as a duplicate of #6800.

Brocco avatar Jul 17 '17 16:07 Brocco

I run chown it's worked sudo chown -r XXX /usr/lib/node_modules/ or sudo chown -r XXX /usr/lib/node_modules/@angular/ if not it might chgrp sudo chgrp -r XXX /usr/lib/node_modules/

thanhtung90 avatar Dec 23 '17 14:12 thanhtung90

sudo npm install -g --unsafe-perm --verbose @angular/cli

d668 avatar Jan 20 '18 14:01 d668

Run following commands npm i -g npm-check-updates npm-check-updates -u npm install

pushkalb123 avatar Jan 22 '18 10:01 pushkalb123

@pushkalb123

and you see in log:

...
gyp ERR! stack Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/build'
...

[npm-check] Update complete!
[npm-check] @angular/[email protected]

😭

WuglyakBolgoink avatar Jan 24 '18 08:01 WuglyakBolgoink

still same issue

bhumin3i avatar Jan 29 '18 12:01 bhumin3i

Please anyone help me on this, this issue only on ios

bhumin3i avatar Jan 30 '18 06:01 bhumin3i

@bhumin3i try to reInstall ngCli with root permissions

and check this https://github.com/angular/angular-cli/issues/6800

WuglyakBolgoink avatar Jan 30 '18 08:01 WuglyakBolgoink

I had the same issue on MacOs. I fixed.

@bhumin3i

try this install first node-gyp sudo npm install node-gyp -g and then install or update the angular sudo npm install -g -f @angular/cli@latest

this was my error in a loop

gyp verb command install [ '9.4.0' ] gyp verb install input version string "9.4.0" gyp verb install installing version: 9.4.0 gyp verb install --ensure was passed, so won't reinstall if already installed gyp verb install version not already installed, continuing with install 9.4.0 gyp verb ensuring nodedir is created /usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/9.4.0 gyp WARN EACCES user "root" does not have permission to access the dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp/9.4.0" gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/lib/node_modules/@angular/cli/node_modules/node-sass/.node-gyp" gyp verb tmpdir == cwd automatically will remove dev files after to save disk space

ediman3d avatar Jan 30 '18 14:01 ediman3d

I have faced and fixed this issue relates node-sass and python error.Try installing latest angular cli command with the steps below

Set the system variable path as well: C:\Users\windowsusername\AppData\Roaming\npm

C:\Users\windowsusername\AppData\Roaming\npm\node_modules@angular\cli\bin;

C:\Program Files\nodejs;

Then start using angular cli command prompt using: angular client project folder path>npm install -g @latest

angular client project folder path>npm install -g node-gyp

SatishMHiremath avatar Feb 17 '18 17:02 SatishMHiremath

Error - gyp ERR! configure error gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/*****/git/angular-webpack/node_modules/node-sass/build'

  1. sudo npm cache clean -f
  2. npm install --save-dev @angular/cli@latest

mrpatel15 avatar Feb 22 '18 18:02 mrpatel15

is there any new changes pushed in node_scss????

gyp verb cli 'rebuild', gyp verb cli '--verbose', gyp verb cli '--libsass_ext=', gyp verb cli '--libsass_cflags=', gyp verb cli '--libsass_ldflags=', gyp verb cli '--libsass_library=' ] gyp info using [email protected] gyp info using [email protected] | darwin | x64 gyp verb command rebuild [] gyp verb command clean [] gyp verb clean removing "build" directory gyp verb command configure [] gyp verb check python checking for Python executable "python2" in the PATH gyp verb which failed Error: not found: python2 gyp verb which failed at getNotFoundError (/Users/test/git/angular-webpack/node_modules/which/which.js:13:12) gyp verb which failed at F (/Users/test/git/angular-webpack/node_modules/which/which.js:68:19) gyp verb which failed at E (/Users/test/git/angular-webpack/node_modules/which/which.js:80:29) gyp verb which failed at /Users/test/git/angular-webpack/node_modules/which/which.js:89:16 gyp verb which failed at /Users/test/git/angular-webpack/node_modules/isexe/index.js:42:5 gyp verb which failed at /Users/test/git/angular-webpack/node_modules/isexe/mode.js:8:5 gyp verb which failed at FSReqWrap.oncomplete (fs.js:166:21) gyp verb which failed python2 { Error: not found: python2 gyp verb which failed at getNotFoundError (/Users/test/git/angular-webpack/node_modules/which/which.js:13:12) gyp verb which failed at F (/Users/test/git/angular-webpack/node_modules/which/which.js:68:19) gyp verb which failed at E (/Users/test/git/angular-webpack/node_modules/which/which.js:80:29) gyp verb which failed at /Users/test/git/angular-webpack/node_modules/which/which.js:89:16 gyp verb which failed at /Users/test/git/angular-webpack/node_modules/isexe/index.js:42:5 gyp verb which failed at /Users/test/git/angular-webpack/node_modules/isexe/mode.js:8:5 gyp verb which failed at FSReqWrap.oncomplete (fs.js:166:21) gyp verb which failed stack: 'Error: not found: python2\n

mrpatel15 avatar Feb 22 '18 19:02 mrpatel15

I was getting the same frustrating error, it's definitely a permissions issue. If you've been using NPM with sudo for a while and don't want to go through the hassle of reinstalling everything (at least not right in the middle of a project) I think I found a quick fix.

node-sass refused to install whether I used sudo or not, so I looked at my project directory - ls -ahl and saw that my node_modules directory was set to user root I'm assuming as a consequence of using sudo. I ran a sudo chown yourname:yourgroup node_modules where yourname/yourgroup is the name/group of all your other non-root controlled files and then ran (without sudo) npm i node-sass -D

This did the trick. Just a suggested shortcut.

jcicero518 avatar May 02 '18 21:05 jcicero518

I'm getting the same error on windows when creating a new project knowing that i did npm install overcoming a proxy . I'm really stuck

slim-souissi avatar May 08 '18 09:05 slim-souissi

I solved this by simply yarn add node-sass

saadbinsaeed avatar Jun 11 '18 07:06 saadbinsaeed

@saadbinsaeed I'm getting the following error error https://github.com/doctyper/customizr/tarball/develop: Fetch succeeded for undefined. However, extracting "https://github.com/doctyper/customizr/tarball/develop" resulted in hash "a15f0296a0a2488177085aec4ff42c7aaf5510ef", which did not match the requested hash "845ddb7443eae671efcf5352feaec57d7e6e5f0f".

Mona-Superscientist avatar Jun 13 '18 22:06 Mona-Superscientist

@Mona-Superscientist Are you using the yarn? Try upgrading it to latest version. But first try it by removing your lock file and reinstalling the node modules

saadbinsaeed avatar Jun 14 '18 08:06 saadbinsaeed

" npm install -g --unsafe-perm node-sass " . solved the issue.

rahul-ratra avatar Jun 15 '18 20:06 rahul-ratra