20
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

nan を使ったモジュールの npm install が失敗する時の対応

Last updated at Posted at 2015-11-20

CentOS 6.7, Node.js v4.2.2 の環境で、nan を使ったモジュールをインストールできなかったので、その対応方法をログとして残しておきます。

ことはじめ hiredis が入らない

セッション用DBとして redis を使おうと思って、何も考えず redis, hiredis をインストール

$ npm install hiredis
npm WARN package.json server@0.3.1 No repository field.
npm WARN package.json server@0.3.1 No license field.

> hiredis@0.4.1 install /home/zoeponta/server/node_modules/hiredis
> node-gyp rebuild

make: Entering directory `/home/zoeponta/server/node_modules/hiredis/build'
  CC(target) Release/obj.target/hiredis-c/deps/hiredis/sds.o
  CC(target) Release/obj.target/hiredis-c/deps/hiredis/read.o
  AR(target) Release/obj.target/deps/hiredis-c.a
  COPY Release/hiredis-c.a
  CXX(target) Release/obj.target/hiredis/src/hiredis.o
In file included from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan.h:41:3: error: #error This version of node/NAN/v8 requires a C++11 compiler
In file included from /home/zoeponta/.node-gyp/4.2.2/include/node/node.h:42,
                 from ../node_modules/nan/nan.h:45,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:336: error: expected unqualified-id before ‘using’
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In constructor ‘v8::MaybeLocal<T>::MaybeLocal()’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:353: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘bool v8::MaybeLocal<T>::IsEmpty() const’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:360: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘bool v8::MaybeLocal<T>::ToLocal(v8::Local<S>*) const’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:364: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘bool v8::WeakCallbackInfo<T>::IsFirstPass() const’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:430: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: At global scope:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:469: error: expected unqualified-id before ‘using’
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In constructor ‘v8::Global<T>::Global()’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:790: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In constructor ‘v8::Global<T>::Global(v8::Global<T>&&)’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:815: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘v8::Global<T>& v8::Global<T>::operator=(v8::Global<S>&&)’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:827: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: At global scope:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:852: error: expected unqualified-id before ‘using’
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:1089: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:1095: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘v8::MaybeLocal<v8::Object> v8::Function::NewInstance(v8::Local<v8::Context>) const’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:3205: error: ‘nullptr’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘v8::Local<T> v8::MaybeLocal<T>::ToLocalChecked()’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:7164: error: ‘nullptr’ was not declared in this scope
In file included from ../node_modules/nan/nan.h:194,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan_maybe_43_inl.h: At global scope:
../node_modules/nan/nan_maybe_43_inl.h:13: error: expected unqualified-id before ‘using’
../node_modules/nan/nan_maybe_43_inl.h:16: error: expected unqualified-id before ‘using’
../node_modules/nan/nan_maybe_43_inl.h:19: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:24: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:31: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:36: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:41: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:46: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:51: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:60: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:65: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:70: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:77: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:84: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:92: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:99: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:109: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:115: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:119: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:126: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:131: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:136: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:140: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:146: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:151: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:157: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:163: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:169: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:175: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:181: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:187: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:195: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:202: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:206: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:210: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:214: error: expected initializer before ‘<’ token
../node_modules/nan/nan_maybe_43_inl.h:218: error: expected initializer before ‘<’ token
In file included from ../node_modules/nan/nan.h:199,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan_converters.h:14: error: ISO C++ forbids declaration of ‘MaybeLocal’ with no type
../node_modules/nan/nan_converters.h:14: error: expected ‘;’ before ‘<’ token
../node_modules/nan/nan_converters.h:16: error: ISO C++ forbids declaration of ‘Maybe’ with no type
../node_modules/nan/nan_converters.h:16: error: expected ‘;’ before ‘<’ token
../node_modules/nan/nan_converters.h:26: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:27: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:28: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:29: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:30: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:31: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:32: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:42: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:43: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:44: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:45: error: ‘return_t’ does not name a type
../node_modules/nan/nan_converters.h:46: error: ‘return_t’ does not name a type
In file included from ../node_modules/nan/nan_converters.h:59,
                 from ../node_modules/nan/nan.h:199,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan_converters_43_inl.h:18: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::Boolean>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:19: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::Number>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:20: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::String>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:21: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::Object>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:22: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::Integer>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:23: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::Uint32>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:24: error: ‘return_t’ in class ‘Nan::imp::ToFactory<v8::Int32>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:34: error: ‘return_t’ in class ‘Nan::imp::ToFactory<bool>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:35: error: ‘return_t’ in class ‘Nan::imp::ToFactory<double>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:36: error: ‘return_t’ in class ‘Nan::imp::ToFactory<long int>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:37: error: ‘return_t’ in class ‘Nan::imp::ToFactory<unsigned int>’ does not name a type
../node_modules/nan/nan_converters_43_inl.h:38: error: ‘return_t’ in class ‘Nan::imp::ToFactory<int>’ does not name a type
In file included from ../node_modules/nan/nan.h:200,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan_new.h: In function ‘v8::Local<T> Nan::imp::To(v8::Local<v8::Integer>) [with T = v8::Integer]’:
../node_modules/nan/nan_new.h:21: error: no matching function for call to ‘To(v8::Local<v8::Integer>&)’
../node_modules/nan/nan_new.h: In function ‘v8::Local<T> Nan::imp::To(v8::Local<v8::Integer>) [with T = v8::Int32]’:
../node_modules/nan/nan_new.h:28: error: no matching function for call to ‘To(v8::Local<v8::Integer>&)’
../node_modules/nan/nan_new.h: In function ‘v8::Local<T> Nan::imp::To(v8::Local<v8::Integer>) [with T = v8::Uint32]’:
../node_modules/nan/nan_new.h:35: error: no matching function for call to ‘To(v8::Local<v8::Integer>&)’
../node_modules/nan/nan_new.h: At global scope:
../node_modules/nan/nan_new.h:43: error: ISO C++ forbids declaration of ‘MaybeLocal’ with no type
../node_modules/nan/nan_new.h:43: error: expected ‘;’ before ‘<’ token
../node_modules/nan/nan_new.h:75: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:141: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:147: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:148: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:160: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:161: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:162: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:163: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:165: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:166: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:182: error: ‘return_t’ does not name a type
../node_modules/nan/nan_new.h:183: error: ‘return_t’ does not name a type
In file included from ../node_modules/nan/nan_new.h:189,
                 from ../node_modules/nan/nan.h:200,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan_implementation_12_inl.h:56: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::Date>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static v8::Local<v8::Function> Nan::imp::Factory<v8::Function>::New(void (*)(const Nan::FunctionCallbackInfo<v8::Value>&), v8::Local<v8::Value>)’:
../node_modules/nan/nan_implementation_12_inl.h:90: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan_implementation_12_inl.h: In static member function ‘static v8::Local<v8::FunctionTemplate> Nan::imp::Factory<v8::FunctionTemplate>::New(void (*)(const Nan::FunctionCallbackInfo<v8::Value>&), v8::Local<v8::Value>, v8::Local<v8::Signature>)’:
../node_modules/nan/nan_implementation_12_inl.h:118: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan_implementation_12_inl.h: At global scope:
../node_modules/nan/nan_implementation_12_inl.h:197: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::RegExp>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:216: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::Script>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:222: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::Script>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:254: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:262: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:268: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:275: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:281: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:286: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:347: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::UnboundScript>’ does not name a type
../node_modules/nan/nan_implementation_12_inl.h:354: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::UnboundScript>’ does not name a type
In file included from ../node_modules/nan/nan.h:200,
                 from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan_new.h:293: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:299: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:305: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:311: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:317: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:323: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:329: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::String>’ does not name a type
../node_modules/nan/nan_new.h:335: error: ‘return_t’ in class ‘Nan::imp::Factory<v8::RegExp>’ does not name a type
In file included from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::Error(const char*)’:
../node_modules/nan/nan.h:651: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::ThrowError(const char*)’:
../node_modules/nan/nan.h:651: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::RangeError(const char*)’:
../node_modules/nan/nan.h:652: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::ThrowRangeError(const char*)’:
../node_modules/nan/nan.h:652: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::ReferenceError(const char*)’:
../node_modules/nan/nan.h:653: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::ThrowReferenceError(const char*)’:
../node_modules/nan/nan.h:653: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::SyntaxError(const char*)’:
../node_modules/nan/nan.h:654: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::ThrowSyntaxError(const char*)’:
../node_modules/nan/nan.h:654: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Value> Nan::TypeError(const char*)’:
../node_modules/nan/nan.h:655: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::ThrowTypeError(const char*)’:
../node_modules/nan/nan.h:655: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:663: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:685: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:701: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:714: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:731: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:737: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:745: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:752: error: expected initializer before ‘<’ token
../node_modules/nan/nan.h:758: error: expected initializer before ‘<’ token
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h: In member function ‘void Nan::Callback::SetFunction(const v8::Local<v8::Function>&)’:
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:3021: error: argument dependent lookup finds ‘class v8::Set’
../node_modules/nan/nan.h:1394: error:   in call to ‘Set’
../node_modules/nan/nan.h: In member function ‘void Nan::AsyncWorker::SaveToPersistent(const char*, const v8::Local<v8::Value>&)’:
../node_modules/nan/nan.h:1516: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In member function ‘v8::Local<v8::Value> Nan::AsyncWorker::GetFromPersistent(const char*) const’:
../node_modules/nan/nan.h:1534: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In member function ‘virtual void Nan::AsyncWorker::HandleErrorCallback()’:
../node_modules/nan/nan.h:1568: error: no matching function for call to ‘New(const char*)’
../node_modules/nan/nan.h: In function ‘void Nan::SetMethod(const T&, const char*, void (*)(const Nan::FunctionCallbackInfo<v8::Value>&))’:
../node_modules/nan/nan.h:1857: error: there are no arguments to ‘GetFunction’ that depend on a template parameter, so a declaration of ‘GetFunction’ must be available
../node_modules/nan/nan.h:1857: note: (if you use ‘-fpermissive’, G++ will accept your code, but allowing the use of an undeclared name is deprecated)
../node_modules/nan/nan.h:1858: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::SetPrototypeMethod(v8::Local<v8::FunctionTemplate>, const char*, void (*)(const Nan::FunctionCallbackInfo<v8::Value>&))’:
../node_modules/nan/nan.h:1870: error: ‘GetFunction’ was not declared in this scope
../node_modules/nan/nan.h:1871: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, void (*)(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Value>&), void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const Nan::PropertyCallbackInfo<void>&), v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)’:
../node_modules/nan/nan.h:1896: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan.h: In function ‘bool Nan::SetAccessor(v8::Local<v8::Object>, v8::Local<v8::String>, void (*)(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Value>&), void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const Nan::PropertyCallbackInfo<void>&), v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute)’:
../node_modules/nan/nan.h:1939: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan.h: In function ‘void Nan::SetNamedPropertyHandler(v8::Local<v8::ObjectTemplate>, void (*)(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Value>&), void (*)(v8::Local<v8::String>, v8::Local<v8::Value>, const Nan::PropertyCallbackInfo<v8::Value>&), void (*)(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Integer>&), void (*)(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Boolean>&), void (*)(const Nan::PropertyCallbackInfo<v8::Array>&), v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:1987: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan.h: In function ‘void Nan::SetIndexedPropertyHandler(v8::Local<v8::ObjectTemplate>, void (*)(uint32_t, const Nan::PropertyCallbackInfo<v8::Value>&), void (*)(uint32_t, v8::Local<v8::Value>, const Nan::PropertyCallbackInfo<v8::Value>&), void (*)(uint32_t, const Nan::PropertyCallbackInfo<v8::Integer>&), void (*)(uint32_t, const Nan::PropertyCallbackInfo<v8::Boolean>&), void (*)(const Nan::PropertyCallbackInfo<v8::Array>&), v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:2057: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan.h: In function ‘void Nan::SetCallHandler(v8::Local<v8::FunctionTemplate>, void (*)(const Nan::FunctionCallbackInfo<v8::Value>&), v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:2112: error: ‘NewInstance’ was not declared in this scope
../node_modules/nan/nan.h: In function ‘void Nan::SetCallAsFunctionHandler(v8::Local<v8::ObjectTemplate>, void (*)(const Nan::FunctionCallbackInfo<v8::Value>&), v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:2134: error: ‘NewInstance’ was not declared in this scope
In file included from ../src/reader.h:1,
                 from ../src/hiredis.cc:1:
../node_modules/nan/nan.h: In function ‘void Nan::Export(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE, const char*, void (*)(const Nan::FunctionCallbackInfo<v8::Value>&))’:
../node_modules/nan/nan.h:2161: error: no matching function for call to ‘New(const char*&)’
../node_modules/nan/nan.h:2162: error: ‘GetFunction’ was not declared in this scope
/home/zoeponta/.node-gyp/4.2.2/include/node/v8.h:3021: error: argument dependent lookup finds ‘class v8::Set’
../node_modules/nan/nan.h:2162: error:   in call to ‘Set’
../node_modules/nan/nan.h: In constructor ‘Nan::Tap::Tap(v8::Local<v8::Value>)’:
../node_modules/nan/nan.h:2169: error: no matching function for call to ‘To(v8::Local<v8::Value>&)’
../node_modules/nan/nan.h: In member function ‘void Nan::Tap::ok(bool, const char*)’:
../node_modules/nan/nan.h:2182: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: In member function ‘void Nan::Tap::pass(const char*)’:
../node_modules/nan/nan.h:2188: error: ‘class v8::Local<v8::Boolean>’ has no member named ‘ToLocalChecked’
../node_modules/nan/nan.h: At global scope:
../node_modules/nan/nan.h:2212: error: ISO C++ forbids declaration of ‘MaybeLocal’ with no type
../node_modules/nan/nan.h:2212: error: expected ‘;’ before ‘<’ token
../node_modules/nan/nan.h:2215: error: expected ‘;’ before ‘}’ token
../node_modules/nan/nan.h:2217: error: ‘MaybeLocal’ was not declared in this scope
../node_modules/nan/nan.h:2217: error: template argument 1 is invalid
../node_modules/nan/nan.h:2217: error: expected unqualified-id before ‘>’ token
../node_modules/nan/nan.h:2226: error: expected constructor, destructor, or type conversion before ‘<’ token
make: *** [Release/obj.target/hiredis/src/hiredis.o] Error 1
make: Leaving directory `/home/zoeponta/server/node_modules/hiredis/build'
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/zoeponta/.nodebrew/node/v4.2.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 2.6.32-431.3.1.el6.x86_64
gyp ERR! command "/home/zoeponta/.nodebrew/node/v4.2.2/bin/node" "/home/zoeponta/.nodebrew/node/v4.2.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/zoeponta/server/node_modules/hiredis
gyp ERR! node -v v4.2.2
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok 
npm ERR! Linux 2.6.32-431.3.1.el6.x86_64
npm ERR! argv "/home/zoeponta/.nodebrew/node/v4.2.2/bin/node" "/home/zoeponta/.nodebrew/current/bin/npm" "install" "hiredis"
npm ERR! node v4.2.2
npm ERR! npm  v2.14.7
npm ERR! code ELIFECYCLE

npm ERR! hiredis@0.4.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the hiredis@0.4.1 install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the hiredis package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls hiredis
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/zoeponta/server/npm-debug.log

エラー文をよく読んでみると nan でエラーを吐いている

../node_modules/nan/nan.h:41:3: error: #error This version of node/NAN/v8 requires a C++11 compiler

nan の github の issue を調べてみると #448 にそれっぽいことが見つかる。一言で言うと 「g++ のバージョンを 4.8 あげるとうまくいくよ」ということらしい

というわけで g++ 4.8 にアップグレードしてみる

やり方は、@giwa さんの記事を参考にさせていただきました。手順はそのままです。

$ wget http://people.centos.org/tru/devtools-2/devtools-2.repo -O /etc/yum.repos.d/devtools-2.repo
$ yum install devtoolset-2-gcc devtoolset-2-binutils
$ yum install devtoolset-2-gcc-c++ devtoolset-2-gcc-gfortran
$ scl enable devtoolset-2 bash
$ gcc --version
gcc (GCC) 4.8.2 20140120 (Red Hat 4.8.2-15)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

下記を ~/.bashrc もしくは ~/.bash_profiles に記載します

source /opt/rh/devtoolset-2/enable

もう一度 npm install してみる

$ npm install hiredis
/
> hiredis@0.4.1 install /home/zoeponta/server/node_modules/hiredis
> node-gyp rebuild

make: Entering directory `/home/zoeponta/server/node_modules/hiredis/build'
  CC(target) Release/obj.target/hiredis-c/deps/hiredis/sds.o
  CC(target) Release/obj.target/hiredis-c/deps/hiredis/read.o
  AR(target) Release/obj.target/deps/hiredis-c.a
  COPY Release/hiredis-c.a
  CXX(target) Release/obj.target/hiredis/src/hiredis.o
  CXX(target) Release/obj.target/hiredis/src/reader.o
  SOLINK_MODULE(target) Release/obj.target/hiredis.node
  COPY Release/hiredis.node
make: Leaving directory `/home/zoeponta/server/node_modules/hiredis/build'
hiredis@0.4.1 node_modules/hiredis
├── bindings@1.2.1
└── nan@2.1.0

今回はちゃんと入りました。めでたしめでたし。

最後に

今回私は、hiredis を入れようとして失敗しましたが、hiredis だけでなく同じような問題にぶち当たっている人がいると思うので、その方々の役に立てば嬉しいです。

:imp:

20
18
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
20
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?