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

'libsass bindings not found. Try reinstalling 'node-sass'? #918

Closed Milkbone911 closed 9 years ago

Milkbone911 commented 9 years ago

I'm having a problem when running the command gulp I keep getting this error:

Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/home/vagrant/Code/Auth/node_modules/gulp-sass/node_modules/n
ode-sass/lib/index.js:22:11)
    at Object.<anonymous> (/home/vagrant/Code/Auth/node_modules/gulp-sass/node_m
odules/node-sass/lib/index.js:188:23)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/home/vagrant/Code/Auth/node_modules/gulp-sass/index.
js:3:17)
    at Module._compile (module.js:456:26)

below is my package.json file:

{
  "private": true,
  "devDependencies": {
    "gulp": "^3.8.11",
    "gulp-autoprefixer": "^0.0.7",
    "gulp-sass": "^2.0.0-alpha.1",
    "gulp-util": "^3.0.4",
    "laravel-elixir": "*"
  }
}

anyone have any ideas or thoughts on what could be going on?

isochronous commented 9 years ago

I'll try that, though this would be the first time in 3 years of using node that powershell has gotten in the way. On Sat, Aug 1, 2015 at 10:39 PM Marcin Cieślak notifications@github.com wrote:

I would recommend not to use PowerShell because it recognizes any kind of output to the standard error channel as a fatal error of the executed subprocess (example issue causing the failure is: npm/npm#8841 https://github.com/npm/npm/pull/8841). Just try npm install node-sass with cmd.exe

— Reply to this email directly or view it on GitHub https://github.com/sass/node-sass/issues/918#issuecomment-126981624.

saper commented 9 years ago

I'll try that, though this would be the first time in 3 years of using node that powershell has gotten in the way.

Well, we've run into it and it is a confirmed problem with npm. One can use node for many years without touching any binary modules at all and certainly PowerShell works in 99% of situations.

The issues we face here are not specific to node-sass - similar problems are to be expected whenever native code is used.

isochronous commented 9 years ago

Just an update - I tried using both 64 and 32 bit cmd.exe instead of powershell with the same result. I did just realize that I'm using an old version of node (v0.10.28) so I'm going to update that and see if that makes any difference.

isochronous commented 9 years ago

Updated to v0.12.7 x64, still have the same issue after deleting node_modules and re-running npm install :(

saper commented 9 years ago

I have not enough details to help. Can you dump a full log according to our TROUBLESHOOTING.md guide?

One thing that I noticed is that the system was trying to load 32-bit binding. That should work but I hope that is what is expected.

isochronous commented 9 years ago

Sure thing - I didn't update the error I was getting, but I opened both a 64-bit and 32-bit cmd side-by-side and tried everything in both of them just to make sure I was covering my bases. The binding it was attempting to use may have changed (that should show up in the logs I suppose) but the general error was the same.

isochronous commented 9 years ago
D:\LaunchSite>npm -v
2.11.3

D:\LaunchSite>node -v
v0.12.7

D:\LaunchSite>node -p process.versions
{ http_parser: '2.3',
  node: '0.12.7',
  v8: '3.28.71.19',
  uv: '1.6.1',
  zlib: '1.2.8',
  modules: '14',
  openssl: '1.0.1p' }

D:\LaunchSite>node -p process.platform
win32

D:\LaunchSite>node -p process.arch
x64

At this point I went into node_modules/gulp-sass and ran npm install node-sass. There were no errors on install.

D:\LaunchSite\node_modules\gulp-sass\node_modules\node-sass>type package.json
{
  "name": "node-sass",
  "version": "3.2.0",
  "libsass": "3.2.5",
  /* snip */
}

D:\LaunchSite\node_modules\gulp-sass\node_modules\.bin>node-sass --version
node-sass       3.2.0   (Wrapper)       [JavaScript]
libsass         3.2.5   (Sass Compiler) [C/C++]

D:\LaunchSite\node_modules\gulp-sass\node_modules\.bin>node -p "console.log(require('node-sass').info)"
node-sass       3.2.0   (Wrapper)       [JavaScript]
libsass         3.2.5   (Sass Compiler) [C/C++]
undefined  // <-- what's this?

And here's the error when running from an 64-bit cmd.exe - though I notice it's using the ia32 binding rather than the x64 binding, which seems like it could be a (the?) problem:

D:\LaunchSite>gulp sass

Error: `libsass` bindings not found in D:\LaunchSite\node_modules\gulp-sass\node_modules\node-sass\vendor\win32-ia32-11\binding.node. Try reinstalling `node-sass`?
    at Object.sass.getBinaryPath (D:\LaunchSite\node_modules\gulp-sass\node_modules\node-sass\lib\extensions.js:148:11)
    at Object.<anonymous> (D:\LaunchSite\node_modules\gulp-sass\node_modules\node-sass\lib\index.js:16:36)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (D:\LaunchSite\node_modules\gulp-sass\index.js:163:21)
    at Module._compile (module.js:456:26)
isochronous commented 9 years ago

I should also mention that the troubleshooting guide says to go to https://github.com/sass/node-sass-binaries/tree/v , but that's a 404.

saper commented 9 years ago

So gulp is making us believe we run on 32-bit node, while running on 64-bit?

hexogen commented 9 years ago

Had the same problem but on Ubuntu 14.04(vagrant laravel homestead) host was an Ubuntu 14.04 too. Solved after apt-get update, apt-get upgrade, npm install with sudo permission.

iGeordie commented 9 years ago

I'm also seeing the exact same error messages when using grunt and grunt-sass on windows.

Loading "sass.js" tasks...ERROR
>> Error: `libsass` bindings not found in D:\repos\test\node_modules\grunt-sass\node_modules\node-sass\vendor\win32-ia32-14\binding.node. Try reinstalling `node
-sass`?
Warning: Task "sass" failed. Use --force to continue.
isochronous commented 9 years ago

I don't know if it's gulp doing it or what. However! I can verify that downloading the "missing" ia32 binding file into the appropriate directory fixes the problem. I don't know exactly what is causing node-sass to try using the ia32 bindings, but since 64-bit is perfectly capable of running 32-bit apps, including both x64 and ia32 bindings seems to suffice for a workaround until the actual cause can be identified.

saper commented 9 years ago

Are you using VisualStudio to run some tasks? I think it comes with 32-bit node.

isochronous commented 9 years ago

No, I'm running everything in a cmd.exe shell within ConEmu. Edit: Ah, that question may not have been for me, but in case it was I'll leave this post here.

ckihneman commented 9 years ago

I just went through the process of updating node on my system via homebrew. This lead to this error message popping on me, and not letting me move forward. It seemed to come down to old versions of files floating around, and deleting my node_modules folder then running a fresh npm install after ensuring all packages were referencing their latest versions. Ran right through after that. Here are my steps.

Update node via homebrew:

brew update
brew doctor
brew upgrade node

I recommend using npm-check-updates to update your node modules to latest. Install it and run that command to do a dry run, then pass -u to actually update your package.json file.

Update your global modules: npm update -g

Delete your current node_modules folder.

Run npm install to get a fresh version of everything.

isochronous commented 9 years ago

I assume from the fact that you're using homebrew that you're on OSX. The problem I'm having is on a x64 Windows Server 2012 R2 box, and it's been confirmed by at least one other windows x64 user. I've already done everything you mentioned except for the npm-check-updates step, because, in this particular case, node-sass is just a dependency on another third party package (gulp-sass). Regardless, at the time I reported this bug gulp-sass was already using the most recent version of node-sass, so that wouldn't have helped.

On Thu, Sep 10, 2015 at 7:36 PM Chris Kihneman notifications@github.com wrote:

I just went through the process of updating node on my system via homebrew. This lead to this error message popping on me, and not letting me move forward. It seemed to come down to old versions of files floating around, and deleting my node_modules folder then running a fresh npm install after ensuring all packages were referencing their latest versions. Ran right through after that. Here are my steps.

Update node via homebrew:

brew update brew doctor brew upgrade node

I recommend using npm-check-updates to update your node modules to latest. Install it and run that command to do a dry run, then pass -u to actually update your package.json file.

Update your global modules: npm update -g

Delete your current node_modules folder.

Run npm install to get a fresh version of everything.

— Reply to this email directly or view it on GitHub https://github.com/sass/node-sass/issues/918#issuecomment-139411545.

xzyfer commented 9 years ago

It looks like you're using a version of node-sass that doesn't support Node

  1. Either down grade to an older version of nose or updated to a node-sass

= 3.3.2. On 18 Sep 2015 08:42, "Steven Valladolid" notifications@github.com wrote:

I appreciate the continued attention this thread is receiving. I'm running into similar issues with NVM using node v4.0.0 and npm 2.14.2 on OSX 10.9.5

make: *\ [Release/obj.target/binding/src/binding.o] Error 1 gyp ERR! build error gyp ERR! stack Error: make failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit (/Users/[redacted]/ember_dev/projects/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass/node_modules/pangyp/lib/build.js:272:23) gyp ERR! stack at emitTwo (events.js:87:13) gyp ERR! stack at ChildProcess.emit (events.js:172:7) gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12) gyp ERR! System Darwin 13.4.0 gyp ERR! command "/Users/[redacted]/.nvm/versions/node/v4.0.0/bin/node" "/Users/[redacted]/ember_dev/projects/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass/node_modules/pangyp/bin/node-gyp" "rebuild" gyp ERR! cwd /Users/[redacted]/ember_dev/projects/node_modules/ember-cli-sass/node_modules/broccoli-sass-source-maps/node_modules/node-sass gyp ERR! node -v v4.0.0 gyp ERR! pangyp -v v2.3.2 gyp ERR! not ok

— Reply to this email directly or view it on GitHub https://github.com/sass/node-sass/issues/918#issuecomment-141257688.

saper commented 9 years ago

Somewhere in your system 64-bit and 32-bit environments got mixed. It is enough that even if you are certain you start in a 64-bit environment - something, somewhere (some stupid batch file for example) executes 32-bit node for you. We really depend on the process.arch variable from the node engine we run on to pick up a right binary.

Try logging node -p process.arch at various stages of your pipeline and see where it changes.

saper commented 9 years ago

To everyone who has read up to this point:

This message means that you are using an outdated version of node-sass. You should try to use the newest version: just try the following command and try again:

 npm install node-sass

This is the end. Thank you for your attention! We love you.