sass / node-sass

:rainbow: Node.js bindings to libsass
https://npmjs.org/package/node-sass
MIT License
8.51k stars 1.32k forks source link

Failed at the node-sass@4.7.2 postinstall script. #2397

Closed SimonKomlos closed 6 years ago

SimonKomlos commented 6 years ago

I'm having some problems. Let me try to take you down the steps I took to get me in this situation. Yesterday, everything was working great! Then I did something.. I don't exactly know what I did, but I updated some file from 4.4.0 to 4.7.0.. I think it was either Ionic, Cordova, or NPM related.

After updating I got an error saying that Angular CLI is not compatible with my version of Node. For some reason I decided to follow this tutorial to fix: https://github.com/angular/angular-cli/issues/10527 saying:

  1. Download and save a local copy of the correct version of node-sass binary - win32-x64-64_binding.node. For example download it to the following location: C:\node-sass\win32-x64-64_binding.node
  2. Provide reference to the full path of the node-sass binary file in the sass_binary_path npm configuration parameter (in the ~/.npmrc file): npm config set sass_binary_path For example, npm config set sass_binary_path C:\node-sass\win32-x64-64_binding.node
  3. Run the npm install command again to install @angular/cli correctly.
  4. Execute ng serve or npm start and your should be past the problem.

So I changed the node-sass path. I was still having some issues and realized that to fix I literally just had to download the latest version of NodeJS, which I ended up doing.

I then did npm install on a project I was working on, which then gave me a lovely error:

Failed at the node-sass@4.7.2 postinstall script.

I tried doing npm rebuild node-sass --force which did nothing, unfortunately.

At this point it must've been hour 10 of trying to figure out what the heck was going on, so out a fit of frustration I decided to do a Windows 10 recovery for the previous day. But no, I still have problems.

Here is the error report after doing npm install:

Binary found at C:node-sasswin32-x64-64_binding.node
Testing binary
Binary has a problem: { Error: Cannot find module 'C:node-sasswin32-x64-64_binding.node'

// warnings

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\xampp\htdocs\project x\projectx\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\xampp\htdocs\project x\projectx\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\xampp\htdocs\project x\projectx\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\xampp\\htdocs\\project x\\projectx\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\xampp\htdocs\project x\projectx\node_modules\node-sass
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1
npm WARN angularfire2@5.0.0-rc.10 requires a peer of @angular/common@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angularfire2@5.0.0-rc.10 requires a peer of @angular/core@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angularfire2@5.0.0-rc.10 requires a peer of @angular/platform-browser@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angularfire2@5.0.0-rc.10 requires a peer of @angular/platform-browser-dynamic@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN angularfire2@5.0.0-rc.10 requires a peer of firebase@^5.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN angularfire2@5.0.0-rc.10 requires a peer of rxjs@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN geofire@4.1.2 requires a peer of firebase@^2.4.0 || 3.x.x but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.9.0 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!     C:\Users\Simon K\AppData\Roaming\npm-cache\_logs\2018-05-27T21_04_57_478Z-debug.log

What should I do? I've been struggling with this for hours! Any help, please?

nschonni commented 6 years ago

You can't use 4.7.2 with Node 10. Please delete your node_modules and re-install with a supported Node + node-sass combination. Those instructions on that other thread are bad and will give you a broken workspace

SimonKomlos commented 6 years ago

@nschonni sorry do you mind giving a slightly more detailed answer? I'm on Node v8.11.2, do I downgrade further? and by re-install do you mean npm install?

xzyfer commented 6 years ago
npm update node-sass@latest
SimonKomlos commented 6 years ago

@xzyfer this does nothing I'm afraid. I also just tried completely uninstalling node from my machine and I'm still having this issue..

xzyfer commented 6 years ago

Sounds like you're having multiple different issues unrelated to node-sass. Make sure the version of node-sass is compatible with your version of node, then delete your nodd_modules and run npm.

npm ls node-sass will tell you the version you've installed. Check the release notes for that version to which Node versions are supported.

Beyond that this is not a node-sass issue.

On Mon., 28 May 2018, 7:26 pm Simon, notifications@github.com wrote:

@xzyfer https://github.com/xzyfer this does nothing I'm afraid. I also just tried completely uninstalling node from my machine and I'm still having this issue..

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/2397#issuecomment-392574539, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWO_ozoHbDffjfD7D-R7knAaWu__5ks5t3DMygaJpZM4UPb88 .

mah14 commented 6 years ago

I have this problem too :( please help me

kieryk123 commented 6 years ago

Did anyone resolve this issue?

xzyfer commented 6 years ago

The solution is always to make to sure your version Node (node --version) is supported by your node-sass version (npm ls node-sass).

Check the support table at the bottom of the release notes i.e. https://github.com/sass/node-sass/releases/tag/v4.7.2.

Run npm update node-sass to install the latest node-sass.

kieryk123 commented 6 years ago

I have a v8.11.2 node version, 4.9.0 node-sass version and 6.1.0 NPM version. I have this issue everywhere when I want to install gulp-sass... I don't install node-sass, but only gulp-sass.

xzyfer commented 6 years ago

What exactly is the issue you're seeing. By commenting on an old issues you've not given us the information required to begin helping.

kieryk123 commented 6 years ago
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/pawelkieryk/Desktop/TEST/node_modules/node-sass/build'
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/Users/pawelkieryk/Desktop/TEST/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/pawelkieryk/Desktop/TEST/node_modules/node-sass
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
Build failed with error code: 1
npm WARN test@1.0.0 No description
npm WARN test@1.0.0 No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.9.0 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/pawelkieryk/.npm/_logs/2018-06-05T14_22_36_001Z-debug.log
kieryk123 commented 6 years ago

I have error as above

xzyfer commented 6 years ago

Your issue is very different.

gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/pawelkieryk/Desktop/TEST/node_modules/node-sass/build'

You have a permission issue. For some reason you cannot write to the directory.

Check the permissions for that folder. What command you running?

kieryk123 commented 6 years ago

I am working on MacBook (I am very new in macOS). I running: sudo npm install gulp-sass

xzyfer commented 6 years ago

You should avoid using sudo with npm, it will break things in weird a wonderful ways. Removing sudo should fix your issue.

kieryk123 commented 6 years ago

I fixed it with this command that I found in another thread on github: sudo npm install -g electron --unsafe-perm=true --allow-root

hiepxanh commented 6 years ago

dont use sudo

AnnieManu commented 6 years ago

I have the same problem, can't download exactly node sass, wrote this command npm install node-sass --save-dev
I tried many solutions, nothing helps, always gives errors, npm ERR! Failed at the node-sass@4.9.0 postinstall script. and some others

mah14 commented 6 years ago

@AnnieManu if your project is new, create that again and don't use ''sudo'' for project installation