Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error installing node module

Tags:

node.js

I've just install the recent node-gyp and I'm using node v4.4.7.

When trying to install node module i'm getting this weird error:

> node-gyp rebuild

make: Entering directory `/node_modules/libxml-xsd/node_modules/libxmljs-mt/build'
  CXX(target) Release/obj.target/xmljs/src/libxmljs.o
make: g++: Command not found
make: *** [Release/obj.target/xmljs/src/libxmljs.o] Error 127
make: Leaving directory `/node_modules/libxmljs-mt/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/share/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 3.19.0-32-generic
gyp ERR! command "nodejs" "/usr/bin/node-gyp" "rebuild"
gyp ERR! cwd /node_modules/libxml-xsd/node_modules/libxmljs-mt
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.10.10
gyp ERR! not ok 
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian

npm ERR! weird error 1
npm ERR! not ok code 0

Please note that in the error it's written i'm using node 0.10.25. When I type:

node -v

I get:

v4.4.7

Can someone help?

like image 450
ohadinho Avatar asked May 26 '26 09:05

ohadinho


1 Answers

First try to install build-essential by running the following.

sudo apt install build-essential

If it says that it is already installed, then first remove gcc, g++, build-essential and install build-essential. To do the same, run this.

sudo apt remove gcc g++ build-essential && sudo apt update && sudo apt install build-essential

Hopefully it solves your problem.

like image 164
SaiKumar Immadi Avatar answered May 30 '26 08:05

SaiKumar Immadi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!