Unable to install node SDK with ES6

I am running a CentOs linux with ES6 when I run the command ‘npm install couchbase’ I keep getting these errors:

npm ERR! Linux 2.6.32-573.22.1.el6.x86_64
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "couchbase"
npm ERR! node v6.2.1
npm ERR! npm  v3.9.6
npm ERR! code ELIFECYCLE

npm ERR! couchbase@2.1.8 install: `prebuild --install`
npm ERR! Exit status 2
.
.
.
.
....

  CXX(target) Release/obj.target/snappy/deps/lcb/contrib/snappy/snappy-stubs-internal.o
  CXX(target) Release/obj.target/snappy/deps/lcb/contrib/snappy/snappy.o
  AR(target) Release/obj.target/deps/lcb/libsnappy.a
  COPY Release/libsnappy.a
  CXX(target) Release/obj.target/jsoncpp/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.o
In file included from /usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/memory:83,
                 from ../deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.cpp:205:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In member function ‘virtual void* std::_Sp_counted_deleter<_Ptr, Deleter, Alloc, _Lp>::_M_get_deleter(const std::type_info&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:146: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In member function ‘virtual void* std::_Sp_counted_ptr_inplace<_Tp, Alloc, Lp>::_M_get_deleter(const std::type_info&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:204: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In constructor ‘std::__shared_ptr<_Tp, Lp>::__shared_ptr(std::_Sp_make_shared_tag, Alloc, _Args&& ...)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:861: error: cannot use typeid with -fno-rtti
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h: In function ‘_Del* std::get_deleter(const std::__shared_ptr<_Tp2, _Lp>&)’:
/usr/lib/gcc/x86_64-redhat-linux/4.4.7/../../../../include/c++/4.4.7/bits/shared_ptr.h:1005: error: cannot use typeid with -fno-rtti
make: *** [Release/obj.target/jsoncpp/deps/lcb/contrib/lcb-jsoncpp/lcb-jsoncpp.o] Error 1
make: Leaving directory `/udrm/udrmv2/node_modules/couchbase/build'
prebuild ERR! build error
prebuild ERR! stack Error: `make` failed with exit code: 2
prebuild ERR! stack     at ChildProcess.onExit (/udrm/udrmv2/node_modules/node-gyp/lib/build.js:276:23)
prebuild ERR! stack     at emitTwo (events.js:106:13)
prebuild ERR! stack     at ChildProcess.emit (events.js:191:7)
prebuild ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
prebuild ERR! not ok
prebuild ERR! build Error: `make` failed with exit code: 2
prebuild ERR! build     at ChildProcess.onExit (/udrm/udrmv2/node_modules/node-gyp/lib/build.js:276:23)
prebuild ERR! build     at emitTwo (events.js:106:13)
prebuild ERR! build     at ChildProcess.emit (events.js:191:7)
prebuild ERR! build     at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)

Seems you need to enable the right GCC flag to fix those errors according to http://stackoverflow.com/questions/8723702/error-cannot-use-typeid-with-fno-rtti
Adding this variable should do it:
“GCC_ENABLE_CPP_RTTI = YES”

I opened the ticket about it: https://issues.couchbase.com/browse/JSCBC-307

Even when it fixed, it does not seem that node6 supports centos6

In file included from ../src/couchbase_impl.h:40,
                 from ../src/couchbase_impl.cc:21:
../../nan/nan.h:43:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from /root/.node-gyp/6.2.2/include/node/node.h:42,
                 from ../src/couchbase_impl.h:39,
                 from ../src/couchbase_impl.cc:21:
/root/.node-gyp/6.2.2/include/node/v8.h:341: error: expected unqualified-id before 'using'

Hi Guys,
Thanks for the help.
After reading through the ticket comments I updated my GCC compiler to a newer version (4.7.2) and that seems to have solved the issue.

1 Like