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

Error: Could not locate the bindings file. #253

Closed
NathanRSmith opened this issue Sep 23, 2014 · 23 comments
Closed

Error: Could not locate the bindings file. #253

NathanRSmith opened this issue Sep 23, 2014 · 23 comments

Comments

@NathanRSmith
Copy link

Hi, I tried installing libxmljs on a CentOS6.5 server and received the following error:

/opt/node-server-qa/node_modules/libxmljs/node_modules/bindings/bindings.js:91
  throw err
        ^
Error: Could not locate the bindings file. Tried:
 → /opt/node-server-qa/node_modules/libxmljs/build/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/build/Debug/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/build/Release/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/out/Debug/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/Debug/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/out/Release/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/Release/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/build/default/xmljs.node
 → /opt/node-server-qa/node_modules/libxmljs/compiled/0.10.29/linux/x64/xmljs.node
    at bindings (/opt/node-server-qa/node_modules/libxmljs/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/opt/node-server-qa/node_modules/libxmljs/lib/bindings.js:1:99)
    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> (/opt/node-server-qa/node_modules/libxmljs/index.js:4:16)
    at Module._compile (module.js:456:26)

Everything seemed to build ok, and I tried rebuilding several times. (Sorry for the long paste):

$ node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using node-gyp@0.10.6
gyp info using node@0.10.29 | linux | x64
gyp info spawn python
gyp info spawn args [ '/usr/bin/gyp',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/opt/node-server-qa/node_modules/libxmljs/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/node-gyp/addon-rpm.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/share/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/usr/share/node',
gyp info spawn args   '-Dmodule_root_dir=/opt/node-server-qa/node_modules/libxmljs',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/opt/node-server-qa/node_modules/libxmljs/build'
  CC(target) Release/obj.target/libxml/vendor/libxml/buf.o
  CC(target) Release/obj.target/libxml/vendor/libxml/catalog.o
  CC(target) Release/obj.target/libxml/vendor/libxml/chvalid.o
  CC(target) Release/obj.target/libxml/vendor/libxml/dict.o
  CC(target) Release/obj.target/libxml/vendor/libxml/encoding.o
  CC(target) Release/obj.target/libxml/vendor/libxml/entities.o
  CC(target) Release/obj.target/libxml/vendor/libxml/error.o
  CC(target) Release/obj.target/libxml/vendor/libxml/globals.o
  CC(target) Release/obj.target/libxml/vendor/libxml/hash.o
  CC(target) Release/obj.target/libxml/vendor/libxml/HTMLparser.o
  CC(target) Release/obj.target/libxml/vendor/libxml/HTMLtree.o
  CC(target) Release/obj.target/libxml/vendor/libxml/legacy.o
  CC(target) Release/obj.target/libxml/vendor/libxml/list.o
  CC(target) Release/obj.target/libxml/vendor/libxml/parser.o
../vendor/libxml/parser.c: In function ‘xmlParseInNodeContext’:
../vendor/libxml/parser.c:13492: warning: pointer targets in passing argument 1 of ‘xmlFindCharEncodingHandler’ differ in signedness
../vendor/libxml/include/libxml/encoding.h:175: note: expected ‘const char *’ but argument is of type ‘const xmlChar *’
  CC(target) Release/obj.target/libxml/vendor/libxml/parserInternals.o
  CC(target) Release/obj.target/libxml/vendor/libxml/pattern.o
  CC(target) Release/obj.target/libxml/vendor/libxml/relaxng.o
  CC(target) Release/obj.target/libxml/vendor/libxml/SAX2.o
  CC(target) Release/obj.target/libxml/vendor/libxml/SAX.o
  CC(target) Release/obj.target/libxml/vendor/libxml/tree.o
  CC(target) Release/obj.target/libxml/vendor/libxml/threads.o
  CC(target) Release/obj.target/libxml/vendor/libxml/uri.o
  CC(target) Release/obj.target/libxml/vendor/libxml/valid.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xinclude.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xlink.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlIO.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlmemory.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlmodule.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlreader.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlregexp.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlsave.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlschemas.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlschemastypes.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlstring.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlunicode.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xmlwriter.o
  CC(target) Release/obj.target/libxml/vendor/libxml/xpath.o
../vendor/libxml/trionan.c:218: warning: ‘trio_is_negative’ defined but not used
  CC(target) Release/obj.target/libxml/vendor/libxml/xpointer.o
  AR(target) Release/obj.target/vendor/libxml/xml.a
  CXX(target) Release/obj.target/xmljs/src/libxmljs.o
  CXX(target) Release/obj.target/xmljs/src/xml_attribute.o
  CXX(target) Release/obj.target/xmljs/src/xml_document.o
  CXX(target) Release/obj.target/xmljs/src/xml_element.o
  CXX(target) Release/obj.target/xmljs/src/xml_comment.o
  CXX(target) Release/obj.target/xmljs/src/xml_namespace.o
  CXX(target) Release/obj.target/xmljs/src/xml_node.o
  CXX(target) Release/obj.target/xmljs/src/xml_sax_parser.o
  CXX(target) Release/obj.target/xmljs/src/xml_syntax_error.o
  CXX(target) Release/obj.target/xmljs/src/xml_xpath_context.o
  SOLINK(target) Release/obj.target/xmljs.node
  SOLINK(target) Release/obj.target/xmljs.node: Finished
  COPY Release/lib.target/xmljs.node
make: Leaving directory `/opt/node-server-qa/node_modules/libxmljs/build'
gyp info ok

So I investigated and tried copying cp build/Release/lib.target/xmljs.node build/xmljs.node from within node_modules/libxmljs/ and things started working. Not sure what the issue is with the bindings file not being copied to the proper location, but thought someone should know. Thanks.

@tinganho
Copy link

I also got the same issue.

@modille
Copy link

modille commented Oct 8, 2014

I ran into the same error on Fedora 20:

$ node -v          
v0.10.32
$ npm -v           
1.3.6

After rebuilding it worked fine for me, though:

$ sudo npm install -g node-gyp
$ cd node_modules/libxmljs
$ node-gyp rebuild

I can paste the rebuild output, if useful.

@defunctzombie
Copy link
Collaborator

Likely a node-gyp issue or possibly some permissions issue. Do not think this is libxmljs at fault here.

@ajitkulk
Copy link

Hi , we see this issue, is there any plan to fix it in libxmljs without the workaround.

@ianmacl
Copy link

ianmacl commented Dec 2, 2014

I was able to get this to work by reverting commit: e610388

As an informational point, the module compiled and worked fine on my Mac workstation. When I deployed it to an Ubuntu box (running 14.04) I received the same message.

Error: Could not locate the bindings file. Tried:
 → /var/lib/neo4j/depends/node_modules/libxmljs/build/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/build/Debug/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/build/Release/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/out/Debug/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/Debug/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/out/Release/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/Release/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/build/default/xmljs.node
 → /var/lib/neo4j/depends/node_modules/libxmljs/compiled/0.10.25/linux/x64/xmljs.node
    at bindings (/var/lib/neo4j/depends/node_modules/libxmljs/node_modules/bindings/bindings.js:88:9)
    at Object.<anonymous> (/var/lib/neo4j/depends/node_modules/libxmljs/lib/bindings.js:1:99)
    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> (/var/lib/neo4j/depends/node_modules/libxmljs/index.js:4:16)
    at Module._compile (module.js:456:26)

Doing a find yielded:

find -name "xmljs.node"
./build/Release/lib.target/xmljs.node
./build/Release/obj.target/xmljs.node

I edited the file in that commit and removed the two lines and did an npm rebuild. After that, things ran as expected without errors.

It is likely an error somewhere else as things worked on Mac but not on Ubuntu, but if you ever did want to investigate why people are starting to have problems on some systems, that might be a good place to start. For now I guess I endure the headache of having to fiddle with that to get it working.

@ianmacl
Copy link

ianmacl commented Dec 2, 2014

Additional Info:
After I edit the file and do an npm rebuild, I get this from find:

find -name xmljs.node
./build/Release/xmljs.node
./build/Release/obj.target/xmljs.node

You'll note that build/Release/xmljs.node is one of the paths listed in the initial error message.

@trestletech
Copy link

This is the only solution I could get working: gwicke@7e1ceaf

@sseide
Copy link

sseide commented Aug 5, 2015

Hi,

When will the fix be available within the official version?
trying an "npm install libxmljs" with current version 0.14.2 gives the error from the initial report.
os: debian 8.1

thanks,
Stefan

@zwily
Copy link

zwily commented Aug 17, 2015

I can't use the npm distributed version of libxmljs either because of this. gwicke/libxmljs@7e1ceaf also fixes it for me.

@ecbftw
Copy link

ecbftw commented Jan 4, 2016

Still can't use libxmljs from npm. Same problem. I had to do this to work around it:

npm install libxmljs
(edit node_modules/libxmljs/binding.gyp to remove the 2 offending lines mentioned above)
cd node_modules/libxmljs/
node-gyp rebuild

I'm on Debian Sid (unstable).

@phil-oolabs
Copy link

I had this problem with the deasync and Node 5.6.0. Solved it with node-gyp rebuild also.

@gwicke
Copy link

gwicke commented Mar 25, 2016

FWIW, this is still happening for me:

@rchipka
Copy link
Member

rchipka commented Jan 17, 2017

Is anyone still affected by this issue?

@liambrownweb
Copy link

I'm running into it now. Tried on Windows, current versions of Node, NPM, and libxmljs.

@qthen
Copy link

qthen commented Mar 20, 2017

Ran into this issue today as well. Thanks for the above context and solutions everyone! gwicke@7e1ceaf fixed this for me.

  • node -v: v.7.6.0
  • npm -v 4.1.2
  • CentOS 6.5

And a rebuild is then necessary.

@pedzed
Copy link

pedzed commented Apr 19, 2017

I am facing this issue as well. My OS is based on Ubuntu (which is based on Debian)

lsb_release -a

No LSB modules are available.
Distributor ID: elementary
Description: elementary OS 0.4 Loki
Release: 0.4
Codename: loki

node --version && npm --version

v6.10.2
3.10.10

"libxmljs": "^0.18.4",

Edit:

rm node_modules/ && yarn # (npm install)

gives me:

node_modules/libxmljs/build/Release/xmljs.node'
was compiled against a different Node.js version using
NODE_MODULE_VERSION 48. This version of Node.js requires
NODE_MODULE_VERSION 53. Please try re-compiling or re-installing
the module (for instance, using npm rebuild ornpm install).

Edit 2:

npm rebuild --update-binary

gives me:

node-pre-gyp http GET https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v48-linux-x64.tar.gz
node-pre-gyp ERR! Tried to download(undefined): https://github.com/libxmljs/libxmljs/releases/download/v0.18.4/node-v48-linux-x64.tar.gz
node-pre-gyp ERR! Pre-built binaries not found for libxmljs@0.18.4 and node@6.10.2 (node-v48 ABI) (falling back to source compile with node-gyp)
node-pre-gyp http getaddrinfo ENOTFOUND github.com github.com:443

Edit 3: Relates to #463.

Edit 4: I updated my NodeJS/NPM...

node --version && npm --version

v7.9.0
4.2.0

Now instead of NODE_MODULE_VERSION 48, it complains about NODE_MODULE_VERSION 51, which apparently must be 53. I already updated to the latest version...

This is tiring.

@rainabba
Copy link

rainabba commented Jun 9, 2017

Myself as well now running in WSL (Ubuntu on Windows 10).

I've also tried git cloneing the source to node_modules and that got me no further.

To borrow from pedzed's wonderful format......

lsb_release -a

No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 16.04.2 LTS
Release: 16.04
Codename: xenial

node --version && npm --version

v6.10.3
5.0.3

npm install || npm rebuild --update-binary

g++: error: /mnt/c/prj/AZPREP/GIT/WEB/BatchManWeb/node_modules/libxmljs-mt/build/Release/xmljs.node: No such file or directory
node-libxslt.target.mk:140: recipe for target 'Release/obj.target/node-libxslt.node' failed
make: *** [Release/obj.target/node-libxslt.node] Error 1
make: Leaving directory '/mnt/c/prj/AZPREP/GIT/WEB/BatchManWeb/node_modules/libxslt/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Linux 4.4.0-43-Microsoft
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mnt/c/prj/AZPREP/GIT/WEB/BatchManWeb/node_modules/libxslt
gyp ERR! node -v v6.10.3
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! libxslt@0.6.5 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the libxslt@0.6.5 install script.

rm -rf node_modules && yarn

yarn install v0.24.5
info No lockfile found.
[1/4] Resolving packages...
warning grunt-bower-task > bower@1.8.0: ..psst! While Bower is maintained, we recommend Yarn and Webpack for new front-end projects! Yarn's advantage is security and reliability, and Webpack's is support for both CommonJS and AMD projects. Currently there's no migration path but we hope you'll help us figure out one.
warning vanguard-core > electron@0.4.1: The original electron project has been moved. Visit github.com/logicalparadox/electron for more details.
warning gulp > vinyl-fs > glob-stream > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp > vinyl-fs > glob-watcher > gaze > globule > glob > graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
warning grunt-forever > forever > forever-monitor > minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning socket.io > socket.io-parser > isarray@2.0.1: Just use Array.isArray directly
warning gulp-import-xslt > istanbul > fileset > minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
warning gulp-import-xslt > through2 > xtend > object-keys@0.4.0:
[2/4] Fetching packages...
error tedious@0.1.5: The engine "node" is incompatible with this module. Expected version "0.6 || 0.7 || 0.8 || 0.9".
error Found incompatible module

Not sure if that error is more about how this project works in yarn, or if it's more about the issue I'm facing (I didn't know what yarn did 10 minutes ago and an hour ago I was thinking about putting up my own npm proxy/cache) :)

UPDATE: I think that yarn error has more to do with a totally different (xslt related) module being used inside my grunt task which is called by the postinstall script.

@morrisalp
Copy link

I also had this issue when building my project with libxmljs 0.18.4 and I had to use 0.18.3 instead. The node-gyp suggestion above did not solve this issue for me. Node v6.10.2, npm 3.10.10.

@masselit
Copy link

masselit commented Dec 9, 2017

I had same problem
just try that:
projectToto > $ sudo rm -rf node_modules/
projectToto > $ npm install bindings

npm about binding -> https://www.npmjs.com/package/bindings

@shmuel-web
Copy link

shmuel-web commented Mar 5, 2018

this one worked for me
sudo rm -rf node_modules/
npm install bindings
thanks @masselit

@MeiKatz
Copy link

MeiKatz commented Dec 1, 2018

Well, I tried the solutions above but none did work for me. So I solved it my way like this:
I changed node_modules/libxmls/lib/bindings.js from

module.exports = require('bindings')('xmljs');

to

module.exports = require('bindings')({
  "bindings": "xmljs",
  "module_root": process.cwd() + "/node_modules/libxmljs",
});

Okay, it's not a bulletproof solution but it works for me. If anybody knows how to make this cleaner I want to hear it.

@cryptonkid
Copy link

After once you have done step as done by @MeiKatz go back to the root project folder i.e.
Drive://
and then run the rebuild command
npm rebuild

@All3xJ
Copy link

All3xJ commented Jul 24, 2024

What I did was copying cp build/Release/lib.target/xmljs.node build/xmljs.node from within node_modules/libxmljs/ and things started working

as suggested by OP, and now it finally works.................. I wasted an afternoon.

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