Skip to content

Installation error: permission denied for node-sas #6848

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

Closed
macliems opened this issue Jun 30, 2017 · 35 comments
Closed

Installation error: permission denied for node-sas #6848

macliems opened this issue Jun 30, 2017 · 35 comments

Comments

@macliems
Copy link

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
Copy link
Contributor

May want to check out #6800

@ddimaria
Copy link

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

@Brocco
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 as completed Jul 17, 2017
@thanhtung90
Copy link

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/

@d668
Copy link

d668 commented Jan 20, 2018

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

@pushkalb123
Copy link

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

@WuglyakBolgoink
Copy link

@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
Copy link

still same issue

@bhumin3i
Copy link

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

@WuglyakBolgoink
Copy link

@bhumin3i try to reInstall ngCli with root permissions

and check this #6800

@ediman3d
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
Copy link

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
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
Copy link

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
Copy link

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
Copy link

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
Copy link

I solved this by simply yarn add node-sass

@Mona-Superscientist
Copy link

@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
Copy link

@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
Copy link

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

@amartinezh
Copy link

You Need:
sudo npm install node-gyp -g

@damanwiththeplan
Copy link

npm install --unsafe-perm --force

@A-lee-201
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
Copy link

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
Copy link

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
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

@JaieParker
Copy link

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.

That worked for me on Docker node:10 thanks heaps

@WuglyakBolgoink
Copy link

with --unsafe-perm should work anyway! I don't think, that using "root" user is a good practice by using docker-images, especially on production-server

@rafaelrpbelo
Copy link

@WuglyakBolgoink

with --unsafe-perm should work anyway! I don't think, that using "root" user is a good practice by using docker-images, especially on production-server

Why? root is the default user and all of that will run inside a container (if you're using docker, of course). I believe that's the main purpose of using an isolated context, but you can try set another user anyway.

@adamdport
Copy link

After throwing everything I knew at it, restarting my computer resolved the issue for me. It's possible that either IntelliJ or my corporate antivirus was interfering with it? Thought I'd share in case someone else is out of ideas 😄

@robots4life
Copy link

robots4life commented Apr 30, 2019

@adamdport lol, "have you tried turning it off and on again?" nice one!

@yogeshpatil143
Copy link

Hi All,

Please include below command in your route folder.

sudo npm install -g --unsafe-perm node-sass

It's working fine.

@lakinmohapatra
Copy link

No need to worry .
After installing via angular CLI , use following command .
npm install --unsafe-perm=true --allow-root

@codenpk
Copy link

codenpk commented Jul 31, 2019

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

instead of this just try to install everything as non-root user

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests