node-sass icon indicating copy to clipboard operation
node-sass copied to clipboard

Same binding could not be found and ... could be found

Open saper opened this issue 6 years ago • 6 comments

node 13 with node-sass 4.13.0:

How to reproduce:

~/node_modules/node-sass contains node-sass 4.13.0 without any binding binary.

at the same time node-sass 4.13.0 is installed globally in /usr/local/lib/node_modules/node-sass and contains the binary file.

> find /home/saper/node_modules/node-sass/vendor/ /usr/local/lib/node_modules/node-sass/vendor
/home/saper/node_modules/node-sass/vendor/
/home/saper/node_modules/node-sass/vendor/freebsd-x64-79
/usr/local/lib/node_modules/node-sass/vendor
/usr/local/lib/node_modules/node-sass/vendor/freebsd-x64-59
/usr/local/lib/node_modules/node-sass/vendor/freebsd-x64-59/binding.node
/usr/local/lib/node_modules/node-sass/vendor/freebsd-x64-79
/usr/local/lib/node_modules/node-sass/vendor/freebsd-x64-79/binding.node

The message trying to run npm test on https://github.com/lunelson/node-sass-error-trace is the following:

> npm t
^A^Nnpm WARN npm npm does not support Node.js v13.0.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.
npm WARN npm You can find the latest version at https://nodejs.org/

> @lunelson/[email protected] test /home/saper/sw/node-sass-error-trace
> node test.js

/home/saper/node_modules/node-sass/lib/binding.js:15
      throw new Error(errors.missingBinary());
      ^

Error: Missing binding /home/saper/node_modules/node-sass/vendor/freebsd-x64-79/binding.node
Node Sass could not find a binding for your current environment: FreeBSD 64-bit with Node.js 13.x

Found bindings for the following environments:
  - FreeBSD 64-bit with Node.js 13.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 (/home/saper/node_modules/node-sass/lib/binding.js:15:13)
    at Object.<anonymous> (/home/saper/node_modules/node-sass/lib/index.js:14:35)
    at Module._compile (internal/modules/cjs/loader.js:958:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:994:10)
    at Module.load (internal/modules/cjs/loader.js:813:32)
    at Function.Module._load (internal/modules/cjs/loader.js:725:14)
    at Module.require (internal/modules/cjs/loader.js:850:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/home/saper/sw/node-sass-error-trace/test.js:1:12)
    at Module._compile (internal/modules/cjs/loader.js:958:30)
npm ERR! Test failed.  See above for more details.

As strange as this situation is, we should never say "Missing binding for FreeBSD 64-bit with Node.js 13.x, found binding for FreeBSD 64-bit with Node.js 13.x"

saper avatar Oct 30 '19 04:10 saper

Right now, we have node-sass specified as 4.12.0 on one machine, but on another fresh machine with the same baseline, we run npm install and it deletes it from npm-shrinkwrap.json and wants 4.13.0?

STOP UPGRADING VERSIONS WHEN NOBODY ASKS YOU TO.

mpnewcomb avatar Dec 17 '19 16:12 mpnewcomb

Node 12 with node-sass 4.13.0 is also a problem. Getting this in my CI (where npm install is run right before build):

ERR! Module build failed (from ./node_modules/sass-loader/lib/loader.js):
ERR! Error: Missing binding /home/circleci/react-chart-editor/node_modules/node-sass/vendor/linux-x64-72/binding.node
ERR! Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 12.x
ERR! 
ERR! Found bindings for the following environments:
ERR!   - Linux 64-bit with Node.js 8.x

dmt0 avatar Dec 23 '19 19:12 dmt0

@dmt0 this isn't the same issue as in this thread. You have a binding for an older node release. You can try deleting your node_modules and re-install

nschonni avatar Dec 23 '19 21:12 nschonni

@nschonni As I mentioned above, the problem appears in CI. There is no old node_mudules to delete. https://circleci.com/gh/plotly/react-chart-editor/2718

dmt0 avatar Dec 23 '19 22:12 dmt0

@dmt0 you're restoring a cached version of node_modules as the third step in the CI

nschonni avatar Dec 23 '19 22:12 nschonni

getBinaryDir() simply assumes things are located one level below. This should be be the case. Since we have introduced "humany-friendly" checks we fail in situations where plain node loading would work.

saper avatar Mar 18 '20 09:03 saper