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?

saper commented 9 years ago

Which node? Which npm? Which platform, operating system?

xzyfer commented 9 years ago

Please follow the relevant in our Troubleshooting guide and reply if the problem persists.

Milkbone911 commented 9 years ago

ran through all the steps on the troubleshooting guide, and have provided the results below.

npm -v: 2.7.4
node -v: v0.12.2
node -p process.versions: { http_parser: '2.3',
                          node: '0.12.2',
                          v8: '3.28.73',
                          uv: '1.4.2-node1',
                          zlib: '1.2.8',
                          modules: '14',
                          openssl: '1.0.1m' }
node -p process.platform: win32
node -p process.arch: x64
.\node_modules\.bin\node-sass --version: 2.1.1

I'm still having this issue, hopefully we can get it resolved.

saper commented 9 years ago

Running npm install as root?

Milkbone911 commented 9 years ago

Yes, even when installing from root, the problem still occurs.

saper commented 9 years ago

Can you post a complete log to gist.github.com?

Can you try as a non-root user?

Milkbone911 commented 9 years ago

can't seem to find any log files to copy over. I've tried as both non-root and root.

saper commented 9 years ago

Do you have a vendor subdirectory under node-sass? If yes, what's there?

Milkbone911 commented 9 years ago

there is a win32-x64-node-0.12 file, and in that is binding.node thats everything thats under the vendor file.

chrishomer commented 9 years ago

We ran into this when upgrading from 0.10.x to 0.12.2. Fixed by deleting the node_modules directory and then reinstalling from scratch with npm install.

xzyfer commented 9 years ago

@Milkbone since .\node_modules\.bin\node-sass --version isn't producing an error node-sass has installed fine. The appears to be with the version of gulp-sass you're using.

I can't find any reference to gulp-sass@^2.0.0-alpha.1. Please try a stable version.

Milkbone911 commented 9 years ago

Thanks for the extended support with this everyone, I really appreciate it. I searched through the gulp-sass github-discussion and it seems like gulp-sass 1.3.3 was one of the most stable builds available. I used npm uninstall gulp-sass then, npm install gulp-sass@1.3.3 --save-dev then ssh'd back into my vagrant/homestead vm and ran gulp and still received the following error

Error: `libsass` bindings not found. Try reinstalling `node-sass`?
    at getBinding (/home/vagrant/Code/Auth/node_modules/node-sass/lib/index.js:2
2:11)
    at Object.<anonymous> (/home/vagrant/Code/Auth/node_modules/node-sass/lib/in
dex.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)
saper commented 9 years ago

So, do I understand this correctly - node-sass installed fine, it only happens when you run gulp?

Can you try running home/vagrant/Code/Auth/node_modules/node-sass/bin/node-sass and process some very simple document, like /* ..... */

Milkbone911 commented 9 years ago

Correct, everything installs with no errors. one I run gulp I get the error, do you think it could be a problem with gulp? and sure I can try and display the results here.

saper commented 9 years ago

On Tue, 5 May 2015, Milkbone wrote:

Correct, everything installs with no errors. one I run gulp I get the error, do you think it could be a problem with gulp? and sure I can try and display the results here.

Most probably you have some node_modules with an older/wrong node-sass somewhere down there, and gulp pickes up that.

You can try

 node -e "console.log(require.resolve('node-sass'))"

to see where you current node-sass is.

Milkbone911 commented 9 years ago

here's what I get when I run that, it seems to the correct install

\Projects\Auth> node -e "console.log(require.resolve('node-sass'))"

\Projects\Auth\node_modules\node-sass\lib\index.js
saper commented 9 years ago

On Tue, 5 May 2015, Milkbone wrote:

here's what I get when I run that, it seems to the correct install

\Projects\Auth> node -e "console.log(require.resolve('node-sass'))"

\Projects\Auth\node_modules\node-sass\lib\index.js

And what is in the \Projects\Auth\node_modules\node-sass\vendor ?

Does \Projects\Auth\node_modules\node-sass\bin\node-sass work?

Milkbone911 commented 9 years ago

Projects\Auth\node_modules\node-sass\vendor\win32-x64-node-0.12inside that is binding.node.

and no just running \Projects\Auth\node_modules\node-sass\bin\node-sass does not work, maybe im not understanding what your asking exactly? my apologize.

saper commented 9 years ago

On Tue, 5 May 2015, Milkbone wrote:

Projects\Auth\node_modules\node-sass\vendor\win32-x64-node-0.12inside that is binding.node.

and no just running \Projects\Auth\node_modules\node-sass\bin\node-sass does not work, maybe im not understanding what your asking exactly? my apologize.

Does not work? An error message? It does say nothing and just waits?

Can you just type /* .... */ and give it enter and ctrl-z ?

Milkbone911 commented 9 years ago

here is whats I get

\Projects\Auth> \Projects\Auth\node_modules\node-sass\bin\node-sass /* .... */
The system cannot find the path specified.
saper commented 9 years ago

what about \Projects\Auth\node_modules\node-sass\.bin\node-sass

(with a dot before bin)

Milkbone911 commented 9 years ago
Projects\Auth> \Projects\Auth\node_modules\node-sass\.bin\node-sass
The system cannot find the path specified.

same thing...

saper commented 9 years ago

On Tue, 5 May 2015, Milkbone wrote:

Projects\Auth> \Projects\Auth\node_modules\node-sass\.bin\node-sass
The system cannot find the path specified.

What is below your \Projects\Auth\node_modules\node-sass ?

Milkbone911 commented 9 years ago

this is whats in my node-sass file http://puu.sh/hCDmj/fef017598b.png

saper commented 9 years ago

On Tue, 5 May 2015, Milkbone wrote:

this is whats in my node-sass file http://puu.sh/hCDmj/fef017598b.png

Can you do

  cd \Projects\Auth\node_modules\
  dir node-sass /s > contents.txt

and post 'contents.txt' to http://gist.github.com ?

Milkbone911 commented 9 years ago

https://gist.github.com/Milkbone/b78c658266b040358c85 hope it helps abit more.

saper commented 9 years ago

Thanks, so now if you start node and then

require('node-sass')

you get something, right?

saper commented 9 years ago

Hold on,

you have

\Projects\Auth\node_modules\node-sass

and

Auth/node_modules/gulp-sass/node_modules/node-sass

which is broken, right? (notice the second one is "under" gulp-sass).

saper commented 9 years ago

And your vagrant is running which operating system?

Milkbone911 commented 9 years ago

Vagrant is running ubuntu 12.02 I believe, okay ill look into messing with the one under gulp-sass and see if I can get it working

Milkbone911 commented 9 years ago

funny, I don't seem to have a node-sass in the gulp-sass node_modules file... not sure whats going on there.

saper commented 9 years ago

You definitely need two different binaries for Windows and for Ubuntu! You can put all binaries needed in the vendor directory together.

saper commented 9 years ago

Seems like your original problem was on Ubuntu and we were troubleshooting Windows.

Milkbone911 commented 9 years ago

Actually I had many many problems with node.js and npm on ubunutu that was fixed as soon as I used the windows to install dependencies. I did so on the recommendation of many people having similar issues to mine, the errors I was having was in relation to the symlink with the virtual machine

saper commented 9 years ago

Ok, but we cannot continue troubleshooting like this.

localjo commented 9 years ago

Like @chrishomer we ran into this when switching between 0.10.x and 0.12.2 (we have a Vagrant plugin that switches node versions in our Vagrant box automatically depending on our project's engines field in package.json). Running rm -rf node_modules && npm install clears things up. But it would be nice to get some more insight on exactly what's happening, since we switch node versions often and we'd like to avoid running into this problem.

xzyfer commented 9 years ago

Please update to gulp-sass@2 to solve this issue.

saper commented 9 years ago

@josiahsprague the solution is relatively easy, you need to build or download all the binaries you need and to put them under vendor subdirectory. We cannot launch automatic download or build one for you every time the environment changes.

This concerns all binary modules, not only node-sass

localjo commented 9 years ago

Thanks @saper. As I understand it now, the binaries that are installed may be different depending on the environment, and if that environment changes after the install, a rm -rf node_modules and npm install should give us the right ones. Thanks for clarifying! :)

saper commented 9 years ago

Well, no need to remove all the node_modules. You can just do npm install in the node-sass directory, or try node scripts/install.js there. You can have multiple binaries in one directory.

xzyfer commented 9 years ago

if that environment changes after the install

This is no long the case in node-sass@3.0.0. Running npm install in a new environment should generate the new binaries automatically.

I could be that this behaviour is not respected when node-sass is a dependency of another modules i.e. gulp-sass. This is worth testing.

mardiros commented 9 years ago

:+1: I don't count the number of time this error appears....

mehany commented 9 years ago
This concerns all binary modules, not only node-sass

@saper I am trying to understand the root cause of the issue on my end. I have a shared folder between two different environments ( Mac, Windows) is that why I get this error? if yes, should I do npm install every time I switch the environment? I also updated my OS recently, may be this is way?

I got rid of it by removing node_modules folder and re-ran npm install

saper commented 9 years ago

Just npm install once from Windows and once from Mac and make sure your vendor subdirectory contains both Mac and Windows bindings.

xzyfer commented 9 years ago

This appears to be resolved. TLDR; if you've recently updated your version of node, or node-sass be sure to remove you node_modules dir because we use native extensions. In the future https://github.com/sass/node-sass/issues/1017 will prevent or warn about these types of issues.

isochronous commented 9 years ago

This is still happening on my machine. Windows Server 2012 R2 Standard, using the following package.json file:

{
  "name": "LaunchTechnologies.Web.LaunchSite",
  "version": "0.1.0",
  "description": "",
  "main": "gulpfile.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "gulp": "^3.9.0",
    "gulp-sass": "^2.0.4"
  }
}

And this is the error I'm getting:

D:\Projects\Launch\ai5\launchsite\source\LaunchTechnologies.Web.LaunchSite\node_modules\gulp-sass\node_modules\node-sass\lib\ext
    throw new Error(['`libsass` bindings not found in ', binaryPath, '. Try re
          ^
Error: `libsass` bindings not found in D:\Projects\Launch\ai5\launchsite\source\LaunchTechnologies.Web.LaunchSite\node_modules\g
vendor\win32-ia32-11\binding.node. Try reinstalling `node-sass`?
    at Object.sass.getBinaryPath (D:\Projects\Launch\ai5\launchsite\source\LaunchTechnologies.Web.LaunchSite\node_modules\gulp-s
xtensions.js:148:11)
    at Object.<anonymous> (D:\Projects\Launch\ai5\launchsite\source\LaunchTechnologies.Web.LaunchSite\node_modules\gulp-sass\nod
: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:\Projects\Launch\ai5\launchsite\source\LaunchTechnologies.Web.LaunchSite\node_modules\gulp-sass\ind
    at Module._compile (module.js:456:26)

Things I've tried with no success:

  1. Completely deleting the node_modules directory and doing a fresh npm install
  2. Doing a npm uninstall of gulp and gulp-sass, then a fresh npm install
  3. Doing a global install of node-sass, and doing a global uninstall of node-sass.
  4. Doing a npm rebuild node-sass from within the node_modules/gulp-sass directory
  5. Doing a npm install with node-sass@2, then node-sass@3 when that didn't work
  6. Banging my head repeatedly against my desk

I should mention that when I do the fresh npm install everything seems to install just fine with no errors. Whenever I do a npm rebuild node-sass it just tells me my existing binaries are fine.

pflannery commented 9 years ago

Windows 10 64bit Node 0.12.7 Npm 2.11.3

I got this message today from inside the task runner built in with Visual Studio 2015. But when I ran node-sass from a console it worked.

I had nodejs 0.12.7 64bit installed but turns out Visual Studio 2015 only runs as a 32bit process. So when I tried to run node-sass via VS 2015 it was trying to find the vendor\win32-ia32-11.bindings file which didn't exist. Instead I had the 64bit bindings file compiled via node-gyp.

I fixed my problem by uninstalling node js 64bit and installing nodejs 32bit version so now it works from within Visual Studio 2015 and the console :)

I'm not quite sure how this scenario happens but it seems that node-gyp was compiling the 64bit bindings but node when run under a 32bit process was trying to resolve the 32bit binding which didn't exist.

saper commented 9 years ago

I'm not quite sure how this scenario happens but it seems that node-gyp was compiling the 64bit bindings but node when run under a 32bit process was trying to resolve the 32bit binding which didn't exist.

you need bindings compiled to much your OS, architecture and the version if node. if you need to use node-sass across multiple engines, you need to download bindings for everybengine you are using. you can keep multiple versions in the vendor directory, and node-sass will pick up the right one.

isochronous commented 9 years ago

Hmmm, good to know. I'm was running the commands from a PowerShell console within ConEmu, so I'll verify that it was running in x64 mode and then report back.

On Sat, Aug 1, 2015, 3:26 PM Marcin Cieślak notifications@github.com wrote:

I'm not quite sure how this scenario happens but it seems that node-gyp was compiling the 64bit bindings but node when run under a 32bit process was trying to resolve the 32bit binding which didn't exist.

you need bindings compiled to much your OS, architecture and the version if node. if you need to use node-sass across multiple engines, you need to download bindings for everybengine you are using. you can keep multiple versions in the vendor directory, and node-sass will pick up the right one.

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

saper commented 9 years ago

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: https://github.com/npm/npm/pull/8841). Just try npm install node-sass with cmd.exe