Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Node sass could not find a binding: detecting wrong node version / ABI #2460

Closed
andrebautista opened this issue Jul 21, 2018 · 13 comments
Closed

Comments

@andrebautista
Copy link

  • NPM version (npm -v): 5.6.0
  • Node version (node -v): v8.11.3
  • Node Process (node -p process.versions):
    { http_parser: '2.8.0',
    node: '8.11.3',
    v8: '6.2.414.54',
    uv: '1.19.1',
    zlib: '1.2.11',
    ares: '1.10.1-DEV',
    modules: '57',
    nghttp2: '1.32.0',
    napi: '3',
    openssl: '1.0.2o',
    icu: '60.1',
    unicode: '10.0',
    cldr: '32.0',
    tz: '2017c' }
  • Node Platform (node -p process.platform): darwin
  • Node architecture (node -p process.arch): x64
  • node-sass version (node -p "require('node-sass').info"):
    node-sass 4.9.2 (Wrapper) [JavaScript]
    libsass 3.5.4 (Sass Compiler) [C/C++]
  • npm node-sass versions (npm ls node-sass):
    preact-test@0.0.0 /Users/AndreBautista/client_work/*****/preact-test
    └── node-sass@4.9.2

I'm running into an issue trying to debug my webpack configuration with the node-nightly package. This is not the same issue that can be debugged via npm rebuild node-sass I've tried that command and several other things regarding the binaries. I've determined it comes down to node versioning.

My stack trace looks like this:

ERROR in ./app/style/index.scss (./node_modules/css-loader??ref--5-1!./node_modules/postcss-loader/lib??ref--5-2!./node_modules/sass-loader/lib/loader.js!./app/style/index.scss)
Module build failed (from ./node_modules/sass-loader/lib/loader.js):
Error: Missing binding /Users/andre/client_work/*****/preact-test/node_modules/node-sass/vendor/darwin-x64-64/binding.node
Node Sass could not find a binding for your current environment: OS X 64-bit with Node.js 10.x

Found bindings for the following environments:
  - OS X 64-bit with Node.js 8.x

This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
    at module.exports (/Users/andre/client_work/*****/preact-test/node_modules/node-sass/lib/binding.js:15:13)
    at Object.<anonymous> (/Users/andre/client_work/*****/preact-test/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (/Users/andre/client_work/*****/preact-test/node_modules/v8-compile-cache/v8-compile-cache.js:178:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
    at Module.load (internal/modules/cjs/loader.js:599:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
    at Function.Module._load (internal/modules/cjs/loader.js:530:3)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (/Users/andre/client_work/*****/preact-test/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
    at Object.sassLoader (/Users/andre/client_work/*****/preact-test/node_modules/sass-loader/lib/loader.js:24:22)

I dug into node-sass/lib/extensions.js to try and see where the error message about Node.js 10.x being used when I have node 8.x installed and when I put a log inside getHumanNodeVersion(abi) to console.log(abi) it alternated and returned:

undefined
64
57
undefined
64
...

That's as far as I could dig since I'm not exactly sure where ABI is being set but according to node 57 is my version and 64 is the 10.x which may be running on my computer somewhere but not that I'm aware of.

Not sure if something else in my build is calling that version of node somehow?

@xzyfer
Copy link
Contributor

xzyfer commented Jul 21, 2018 via email

@andrebautista
Copy link
Author

@xzyfer when I add a console.log(process.versions.node) after the existing console.log the output is

undefined
11.0.0-nightly20180719373aae1f86
64
11.0.0-nightly20180719373aae1f86
57
11.0.0-nightly20180719373aae1f86
undefined
...

@xzyfer
Copy link
Contributor

xzyfer commented Jul 21, 2018 via email

@andrebautista
Copy link
Author

I believe so, when I did a console.log(process.versions) to get more details it returned

{ http_parser: '2.8.0',
  node: '11.0.0-nightly20180719373aae1f86',
  v8: '6.7.288.49-node.15',
  uv: '1.22.0',
  zlib: '1.2.11',
  ares: '1.14.0',
  modules: '64',
  nghttp2: '1.32.0',
  napi: '3',
  openssl: '1.1.0h',
  icu: '62.1',
  unicode: '11.0',
  cldr: '33.1',
  tz: '2018e' }

I'll try asking the nightly people why the name of node is changed. Is there another field that could be used to set the node version here?

@xzyfer
Copy link
Contributor

xzyfer commented Jul 21, 2018 via email

@Goblinlordx

This comment has been minimized.

@Goblinlordx

This comment has been minimized.

@xzyfer
Copy link
Contributor

xzyfer commented Jul 25, 2018

seemingly randomly, it will suddenly start outputting this error

It's not random. The error only happens if you've changed your version of Node i.e. with nvm. When you install node-sass it's couple to a specific major version of Node. If you change versions you need to run npm update node-sass. This is true for all native addons because npm says so.

Unsupported Environment error not missing binding

This means you've changed to a version of Node that too new for your version of node-sass. Native addons can only support the versions of Node that were available at the time the native addon was published. Check the release notes for the version of node-sass you're running (npm ls node-sass) for the supported Node versions, or update to the latest node-sass.

@xzyfer xzyfer closed this as completed Jul 25, 2018
@Goblinlordx
Copy link

Goblinlordx commented Jul 25, 2018

@xzyfer Maybe you are not understanding.

  1. I start a process which runs webpack using watch mode.
  2. It compiles everything successfully.
  3. I make a change to a file.
    3a. In some cases, this works and there is no error.
    3b. In other cases, I start seeing the "Unsupported environment" error in browser console.
  4. After changing a file again sometimes it starts compiling successfully again.

During this time webpack was never stopped. If you are saying the executing version of node changed while running and in memory... I think this is a pretty unreasonable thing to state.

@xzyfer
Copy link
Contributor

xzyfer commented Jul 25, 2018 via email

@estani
Copy link

estani commented Jul 15, 2019

I don't understand if there's a solution/workaround or explanation. I have the same message with node-sass 4.12.0 And I have tried rebuilding it from scratch (--force) and it replies always the same... perhaps is an issue with nvm. I haven't change the version, but in any case, I can't compile it for the current version... it just doesn't work...

@Arcanorum
Copy link

Doesn't work. :S
Seems totally broken.

@UsAndRufus
Copy link

I had to stop using nvm and just update Node to fix this issue. I update Node via n, Node's version manager.

Friendly-users referenced this issue in Friendly-users/node-sass Jul 9, 2024
-----
It is inappropriate to include political and offensive content in public code repositories.

Public code repositories should be neutral spaces for collaboration and community, free from personal or political views that could alienate or discriminate against others. Political content, especially that which targets or disparages minority groups, can be harmful and divisive. It can make people feel unwelcome and unsafe, and it can create a hostile work environment.

Please refrain from adding such content to public code repositories.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants