TooTallNate/node-time

npm ERR! time@0.12.0 install: `node-gyp rebuild`

medaamarnadh opened this issue · 1 comments

Hi Team,

I am getting node-gyp rebuild error in CentOs while installing node-time module.

Can any one help me?

../../nan/nan_callbacks_12_inl.h:480: warning: ‘void Nan::imp::IndexDeleterCallbackWrapper(uint32_t, const v8::PropertyCallbackInfo<v8::Boolean>&)’ defined but not used
../../nan/nan_callbacks_12_inl.h:496: warning: ‘void Nan::imp::IndexQueryCallbackWrapper(uint32_t, const v8::PropertyCallbackInfo<v8::Integer>&)’ defined but not used
make: *** [Release/obj.target/time/src/time.o] Error 1
make: Leaving directory `/var/www/html/cause-node/node_modules/time/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:285: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 2.6.32-573.8.1.el6.x86_64
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/www/html/cause-node/node_modules/time
gyp ERR! node -v v6.9.5
gyp ERR! node-gyp -v v3.6.0
gyp ERR! not ok
npm WARN The package passport is included as both a dev and production dependency.
npm WARN The package passport-facebook is included as both a dev and production dependency.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! time@0.12.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the time@0.12.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2017-06-06T03_44_45_955Z-debug.log```

Finally solved this, I'll leave the solution here for whomever runs into the same problem.

Here's what the problem was, Unbuntu 12.04 only has gcc 4.6.3 in the official repository, but C++11 is only supported from 4.8.1, therefore you need to install 4.8 from a different PPA:

sudo apt-get install python-software-properties
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
sudo apt-get update
sudo apt-get install gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50

Now this alone did not fix the problem since it seems node-gyp uses g++ instead of gcc so just do the same for g++:

sudo apt-get install g++-4.8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50