Reputation: 71
I am attempting to install node-sass and it just won't let me. I have tried updating npm.
I put this in:
sudo npm install -g node-sass
and i get this (starting one line before the error):
gyp verb build dir attempting to create "build" dir:
/Users/matt/node_modules/node-sass/build
gyp ERR! configure error
gyp ERR! stack Error: EACCES: permission denied, mkdir
'/Users/matt/node_modules/node-sass/build'
gyp ERR! System Darwin 17.7.0
gyp ERR! command "/usr/local/bin/node"
"/Users/matt/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "-
-verbose" "--libsass_ext=" "--libsass_cflags=" "--
libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/matt/node_modules/node-sass
gyp ERR! node -v v8.11.1
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN enoent ENOENT: no such file or directory, open
'/Users/matt/package.json'
npm WARN [email protected] requires a peer of ajv@^6.0.0 but
none is installed. You must install peer dependencies yourself.
npm WARN matt No description
npm WARN matt No repository field.
npm WARN matt No README data
npm WARN matt No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] postinstall script.
npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/matt/.npm/_logs/2018-08-02T16_18_15_228Z-
debug.log
Upvotes: 7
Views: 27911
Reputation: 37
For me, the error was solved when downgrading node to version 14 (I was on version 16). The tool mentioned in the following answer helped me switch quickly between node versions: https://stackoverflow.com/a/50287454/13005312
Upvotes: 0
Reputation: 443
I had something similar going on, if nothing from above helps you try to remove the proxy first.
I had an npm ERR! code ECONNREFUSED
issue while trying to install node-sass, so check in your logs if this is happening to you.
If a proxy exists remove it with this command:
npm config set proxy null
npm config set https-proxy null
next, set npm to download from the official package registry:
npm config set registry http://registry.npmjs.org/
Then install your package with
npm install node-sass
Upvotes: 0
Reputation: 137
For me these things didn't work and I had the same issue but I was able to solve it through another app that had the binary for node-sass in the vendor folder so I sudo mv the folder to my other project and it was able to run it ok. I know it might not be a good solution but that was something that I tried that worked.
Upvotes: 0
Reputation: 6682
Workaround, that makes this works:
Go to the folder
username/.npm/node-sass // on linux
username/AppData/Roaming/npm-cache/node-sass //on windows
inside create directory /4.9.2
From this page https://github.com/sass/node-sass-binaries get specific version and put this file inside 4.9.2 folder. Now try run npm installation - should work!
Upvotes: 1
Reputation: 91
try this command:
sudo npm install --save-dev --unsafe-perm node-sass
Upvotes: 1
Reputation: 5363
The best way to get rid of permission issues is by installing npm/node using brew.
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
brew install node
Upvotes: 0
Reputation: 5363
sudo npm install -g --unsafe-perm node-sass
This must fix the problem
Upvotes: 19
Reputation: 1499
Permission problem to your directory '/Users/matt/node_modules/node-sass/build' kindly right click on Users/matt and go to properties uncheck ReadOnly then on the same window move to security check fro every user whether the full control is given for the folder else change it to full-control for Everyone
Upvotes: 1