6
node -v
v4.4.7
npm -v
v2.15.8
node-gyp -v
v3.4.0

I'm trying to run my node app which uses libxmljs module and i'm getting this wierd error:

libxmljs/node_modules/bindings/bindings.js:83
        throw e
        ^

Error: /link/node_modules/libxmljs/build/Release/xmljs.node: undefined symbol: _ZN2v82V837AdjustAmountOfExternalAllocatedMemoryEl
    at Error (native)
    at Object.Module._extensions..node (module.js:434:18)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at bindings (/link/node_modules/libxmljs/node_modules/bindings/bindings.js:76:44)
    at Object.<anonymous> (/link/node_modules/libxmljs/lib/bindings.js:1:99)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)

I tried to npm update and installing libxmljs again. Doesn't work. Any tips?

ohadinho
  • 6,894
  • 16
  • 71
  • 124
  • 1
    Did you install that module with a different Node version than that you're using now? – robertklep Jul 21 '16 at 18:49
  • @robertklep No, but i DID upgrade node lately. Is it possible that there are two versions of node installed and that this module reference the older one ? If so, how can I complete remove the older ? – ohadinho Jul 21 '16 at 19:07
  • I don't think that that can happen. Did you try and reinstall the module (remove it from `node_modules` first, just to be sure) with your current Node version? – robertklep Jul 21 '16 at 19:08
  • @robertklep did it now. Now i'm getting this error: "Error: Could not locate the bindings file." I've rebuild it with node-gyp, and now I'm getting the error in the question again :( – ohadinho Jul 22 '16 at 06:02
  • Why not just use `npm i libxmljs`? – robertklep Jul 22 '16 at 06:04
  • @robertklep what does the "i" mean ? – ohadinho Jul 22 '16 at 06:05
  • Short for `install` – robertklep Jul 22 '16 at 06:05
  • @robertklep I don't understand. I did it. – ohadinho Jul 22 '16 at 06:06
  • You initially said in your comment that you ran `sudo node-gyp rebuild`, which shouldn't be necessary if you re-install the package. I just installed the package myself (same Node version), that worked fine for me. – robertklep Jul 22 '16 at 06:07
  • @robertklep ok.. but it's kind of the same.. I'm still stuck with that issue. It's important to mention that I'm installing that module inside another module I build. The app i'm running uses that module I'm building, but I didn't install libxmljs for it (only install it for the module I'm building) – ohadinho Jul 22 '16 at 06:09
  • @robertklep can you try to install it in a module within your app ? – ohadinho Jul 22 '16 at 06:31
  • Tried that, worked just fine. I assume that your module has `libxmljs` declared as a (regular) dependency? – robertklep Jul 22 '16 at 07:15
  • @robertklep what do you mean regular dependency? I've just npm install it, and require it inside my code – ohadinho Jul 22 '16 at 13:37
  • Declared in the `dependencies` object of the `package.json` that belongs to your module. – robertklep Jul 22 '16 at 16:06
  • @robertklep yes. I'm always using --save – ohadinho Jul 23 '16 at 20:08
  • 2
    If you changed node version on your system, then binary libraries can not to bind correctly with it. This is a common issue but easy to solve: If you always install your modules with `npm install --save`, just need to remove (or rename) node_modules directory and then execute `npm install` to rebuild it. If you installed any modules without the '--save' option, then you should reinstall it by hand (better with '--save' this time). – bitifet Sep 09 '16 at 11:44
  • have you resolved this issue? – Muneem Habib Dec 10 '16 at 09:25
  • @MuneemHabib Yes. The problem is that i've installed node via apt-get. The environment wasn't updated with the latest version/ – ohadinho Dec 11 '16 at 06:06

0 Answers0