New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Installation error: permission denied for node-sas #6848

Closed
macliems opened this Issue Jun 30, 2017 · 26 comments

Comments

Projects
None yet
@macliems
Copy link

macliems commented Jun 30, 2017

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.

> node-sass@4.5.3 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' }

> fsevents@1.1.2 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

> node-sass@4.5.3 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 node-gyp@3.6.2
gyp info using node@8.1.2 | 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: node-sass@4.5.3 (node_modules/@angular/cli/node_modules/node-sass):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: node-sass@4.5.3 postinstall: `node scripts/build.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
@jiverson

This comment has been minimized.

Copy link
Contributor

jiverson commented Jun 30, 2017

May want to check out #6800

@ddimaria

This comment has been minimized.

Copy link

ddimaria commented Jul 10, 2017

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

@Brocco

This comment has been minimized.

Copy link
Contributor

Brocco commented Jul 17, 2017

Closing as a duplicate of #6800.

@Brocco Brocco marked this as a duplicate of #6800 Jul 17, 2017

@Brocco Brocco closed this Jul 17, 2017

@thanhtung90

This comment has been minimized.

Copy link

thanhtung90 commented Dec 23, 2017

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/

@intergleam

This comment has been minimized.

Copy link

intergleam commented Jan 20, 2018

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

@pushkalb123

This comment has been minimized.

Copy link

pushkalb123 commented Jan 22, 2018

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

@WuglyakBolgoink

This comment has been minimized.

Copy link

WuglyakBolgoink commented Jan 24, 2018

@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/cli@1.6.5

😭

@bhumin3i

This comment has been minimized.

Copy link

bhumin3i commented Jan 29, 2018

still same issue

@bhumin3i

This comment has been minimized.

Copy link

bhumin3i commented Jan 30, 2018

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

@WuglyakBolgoink

This comment has been minimized.

Copy link

WuglyakBolgoink commented Jan 30, 2018

@bhumin3i try to reInstall ngCli with root permissions

and check this #6800

@ediman3d

This comment has been minimized.

Copy link

ediman3d commented Jan 30, 2018

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

@SatishMHiremath

This comment has been minimized.

Copy link

SatishMHiremath commented Feb 17, 2018

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

@mrpatel15

This comment has been minimized.

Copy link

mrpatel15 commented Feb 22, 2018

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

This comment has been minimized.

Copy link

mrpatel15 commented Feb 22, 2018

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 node-gyp@3.6.2
gyp info using node@9.0.0 | 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

@jcicero518

This comment has been minimized.

Copy link

jcicero518 commented May 2, 2018

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.

@slim-souissi

This comment has been minimized.

Copy link

slim-souissi commented May 8, 2018

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

@saadbinsaeed

This comment has been minimized.

Copy link

saadbinsaeed commented Jun 11, 2018

I solved this by simply yarn add node-sass

@Mona-Superscientist

This comment has been minimized.

Copy link

Mona-Superscientist commented Jun 13, 2018

@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".

@saadbinsaeed

This comment has been minimized.

Copy link

saadbinsaeed commented Jun 14, 2018

@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

@rahul-ratra

This comment has been minimized.

Copy link

rahul-ratra commented Jun 15, 2018

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

@amartinezh

This comment has been minimized.

Copy link

amartinezh commented Jul 25, 2018

You Need:
sudo npm install node-gyp -g

@patrickabkarian

This comment has been minimized.

Copy link

patrickabkarian commented Aug 9, 2018

npm install --unsafe-perm --force

@A-lee-201

This comment has been minimized.

Copy link

A-lee-201 commented Sep 17, 2018

I solved it by:

  • In the project folder go to node_modules in Finder (on Mac),
  • Get the folder properties using Cmd i
  • Go to Sharing & Permissions
  • Change all permissions from the bottom table to Read & Write
  • Select Apply to enclosed items... from the setting menu under the permission table

This might be a temporary fix until I find a better one.

@agarwalparas

This comment has been minimized.

Copy link

agarwalparas commented Oct 25, 2018

I had also facing this error. None of the above methods work for me. Please follow this. It's Works like a charm !!

For Installing Node in Ubuntu 16 via npm :-

You can install with npm 5.2.0 Version

If you are using nvm :-

nvm install 8.2.1
nvm use 8.2.1
npm install node-sass

If you are using npm separately then upgrade or downgrade npm version to 5.2.0

npm install node-sass
@rafaelrpbelo

This comment has been minimized.

Copy link

rafaelrpbelo commented Dec 23, 2018

I had problem to install by Docker container I got the error:

gyp WARN EACCES user "undefined" does not have permission to access the dev dir "/app/node_modules/node-sass/.node-gyp/8.9.1"

Then I added in my Dockerfile:

USER root

# after node installation:
RUN npm config set user root

I think even you aren't using Docker, you can run npm config set user <your-user> that will work.

@shuvro

This comment has been minimized.

Copy link

shuvro commented Jan 24, 2019

None of these worked. Only worked , when I used Sudo before every npm commands.
sudo npm install -g node-gyp
sudo npm install

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment