sass / node-sass

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

Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x #2512

Closed vuzzlevuzz closed 5 years ago

vuzzlevuzz commented 5 years ago

Having a problem after moving site to another server:

Uncaught Error: Module build failed: ModuleBuildError: Module build failed: Error: Missing binding C:\inetpub\XXXXXXX\node_modules\node-sass\vendor\win32-x64-57\binding.node Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x

Found bindings for the following environments:

  • Windows 64-bit with Node.js 6.x

This usually happens because your environment has changed since running npm install. Run npm rebuild node-sass --force to build the binding for your current environment.

I've tried rebuilding node-sass as well as removing node_modules and running npm install but am still getting the same error

Would really appreciate some help with this

xzyfer commented 5 years ago

As the error message says you appear to have two versions of node installed. Make sure you're running npm install or rebuild in the same node 8 environment i.e. same terminal. It's common for many editors to have their own node versions baked it so double check your tools are using the same node installation.

On Wed., 17 Oct. 2018, 1:35 am Jon Reeves, notifications@github.com wrote:

Having a problem after moving site to another server:

Uncaught Error: Module build failed: ModuleBuildError: Module build failed: Error: Missing binding C:\inetpub\XXXXXXX\node_modules\node-sass\vendor\win32-x64-57\binding.node Node Sass could not find a binding for your current environment: Windows 64-bit with Node.js 8.x

Found bindings for the following environments:

  • Windows 64-bit with Node.js 6.x

This usually happens because your environment has changed since running npm install. Run npm rebuild node-sass --force to build the binding for your current environment.

I've tried rebuilding node-sass as well as removing node_modules and running npm install but am still getting the same error

Would really appreciate some help with this

  • NPM version (npm -v): 6.4.1
  • Node version (node -v): v8.12.0
  • Node Process (node -p process.versions): { http_parser: '2.8.0', node: '8.12.0', v8: '6.2.414.66', uv: '1.19.2', zlib: '1.2.11', ares: '1.10.1-DEV', modules: '57', nghttp2: '1.32.0', napi: '3', openssl: '1.0.2p', icu: '60.1', unicode: '10.0', cldr: '32.0', tz: '2017c' }
  • Node Platform (node -p process.platform): win32
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"): node-sass 4.9.4 (Wrapper) [JavaScript] libsass 3.5.4 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass): +-- laravel-mix@2.1.14 | -- node-sass@4.9.4 deduped-- node-sass@4.9.4

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/2512, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWOMzwUTHKhtoIEw8DU8_wXSmi1xCks5ule6XgaJpZM4XegCH .

vuzzlevuzz commented 5 years ago

Thanks for the response, but I'm not sure that applies here -

This is a newly built server and node has only been installed once.
All the version commands above were run from the same terminal window as the npm install and node-sass rebuild.
I am not using any IDE or other editor. The binding referenced in the error does exist at that location

Would really appreciate any help in how to troubleshoot this and get it working

Thanks

xzyfer commented 5 years ago

What the error message says is that during installation your environment presented as node 6, and so it downloaded the node 6 binary into the node_modules/node-sass/vendor directory.

You can confirm this by deleting the node-sass folder from node_modules, running npm install, and watching the npm output as it downloads the binary.

On Wed., 17 Oct. 2018, 7:08 pm Jon Reeves, notifications@github.com wrote:

Thanks for the response, but I'm not sure that applies here -

This is a newly built server and node has only been installed once. All the version commands above were run from the same terminal window as the npm install and node-sass rebuild. I am not using any IDE or other editor. The binding referenced in the error does exist at that location

Would really appreciate any help in how to troubleshoot this and get it working

Thanks

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/sass/node-sass/issues/2512#issuecomment-430531492, or mute the thread https://github.com/notifications/unsubscribe-auth/AAjZWBrFVEL5jrwAxzE096lCMNu545MBks5uluVogaJpZM4XegCH .

vuzzlevuzz commented 5 years ago

Thanks, I tried that but it downloads the same binary - node-sass\vendor\win32-x64-57\binding.node - which I think is the correct one for node 8.12.0?

Is there something specific I should be looking for in the output - I can't see anything that relates to the node version?

I did notice that at first it was using a cached binary from my user profile which I had to manually delete (node cache clean --force did not remove it). I also uninstalled the windows-build-tools which I originally installed in order to run the node-sass rebuild in case this had put another node version in but it made no difference

I tried the process you described from both Git Bash and PowerShell but both gave the same results ( node -v shows the same in both as well)

Here is the output from npm install after deleting the node-sass folder and cached binary:

PS C:\inetpub\some_website> npm install

node-sass@4.9.4 install C:\inetpub\some_website\node_modules\node-sass node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.4/win32-x64-57_binding.node Download complete .] - : Binary saved to C:\inetpub\some_website\node_modules\node-sass\vendor\win32-x64-57\binding.node Caching binary to C:\Users\admin.site\AppData\Roaming\npm-cache\node-sass\4.9.4\win32-x64-57_binding.node

node-sass@4.9.4 postinstall C:\inetpub\some_website\node_modules\node-sass node scripts/build.js

Binary found at C:\inetpub\some_website\node_modules\node-sass\vendor\win32-x64-57\binding.node Testing binary Binary is fine npm WARN ajv-keywords@3.2.0 requires a peer of ajv@^6.0.0 but none is installed. You must install peer dependencies your self. npm WARN img-loader@3.0.0 requires a peer of imagemin@^5.0.0 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"})

added 22 packages from 39 contributors and audited 13677 packages in 9.005s found 1 moderate severity vulnerability run npm audit fix to fix them, or npm audit for details

xzyfer commented 5 years ago

That is the correct binary for Node 8. You should now have the following file node_modules\node-sass\vendor\win32-x64-57\binding.node which will allow you to run node-sass.

Also confirm you don't have two node-sass installs as potentially indicated in the npm ls at node_modules/laravel-mix/node-modules.

vuzzlevuzz commented 5 years ago

That's the same binary I've always had but am still getting the error. I've just checked the laravel-mix/node_modules and there is no node-sass under there

Any ideas?

vuzzlevuzz commented 5 years ago

OK, our developers have managed to fix the issue. It was to do with an old version of vue being installed somehow - they did an update on vue, then recompiled all the javascript and the error went away

Thanks for all your help with this

yogeshpatil143 commented 5 years ago

Please write this command on Command prompt

npm rebuild node-sass

yaman-ka commented 5 years ago

sass

thanks very much it works for me.

aldo-leka commented 4 years ago

What worked for me was to add "C:\Program Files\nodejs" on top of Options -> Projects and Solutions -> Web Package Management because node-sass picks up VStudio version of node which is 10 for some reason and not the global one which is 12.