2016-06-30 18 views
0

Ich installiere npm install auf meinem CentOS Rechner und es gibt immer wieder den folgenden Fehler. Ich habe alle neuesten dev-tools installiertnpm node-gyp Erstellungsfehler CentOS

Ich habe auch versucht, Downgrade und Upgrade, aber das Problem bleibt gleich. Ich verwende CentOS6 auf Amazon AWS.

npm WARN engine [email protected]: wanted: {"node":">=0.8 <=0.12"} (current: {"node":"4.4.7","npm":"2.15.8"}) 

> [email protected] install /root/NodeJSCID/node_modules/node-stringprep 
> node-gyp rebuild 

gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR 
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR 
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR 
make: Entering directory `/root/NodeJSCID/node_modules/node-stringprep/build' 
    CXX(target) Release/obj.target/node_stringprep/node-stringprep.o 
In file included from ../node-stringprep.cc:1:0: 
../node_modules/nan/nan.h:261:25: error: redefinition of ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Local<T>)’ 
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Local<T> val) { 
         ^
../node_modules/nan/nan.h:256:25: error: ‘template<class T> v8::Local<T> _NanEnsureLocal(v8::Handle<T>)’ previously declared here 
NAN_INLINE v8::Local<T> _NanEnsureLocal(v8::Handle<T> val) { 
         ^
../node_modules/nan/nan.h:661:13: error: ‘node::smalloc’ has not been declared 
    , node::smalloc::FreeCallback callback 
      ^
../node_modules/nan/nan.h:661:35: error: expected ‘,’ or ‘...’ before ‘callback’ 
    , node::smalloc::FreeCallback callback 
           ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(char*, size_t, int)’: 
../node_modules/nan/nan.h:665:50: error: ‘callback’ was not declared in this scope 
     v8::Isolate::GetCurrent(), data, length, callback, hint); 
               ^
../node_modules/nan/nan.h:665:60: error: ‘hint’ was not declared in this scope 
     v8::Isolate::GetCurrent(), data, length, callback, hint); 
                  ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(const char*, uint32_t)’: 
../node_modules/nan/nan.h:672:67: error: call of overloaded ‘New(v8::Isolate*, const char*&, uint32_t&)’ is ambiguous 
    return node::Buffer::New(v8::Isolate::GetCurrent(), data, size); 
                   ^
../node_modules/nan/nan.h:672:67: note: candidates are: 
In file included from ../node_modules/nan/nan.h:25:0, 
       from ../node-stringprep.cc:1: 
/root/.node-gyp/4.4.7/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match> 
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, 
../node_modules/nan/nan.h:672:67: note: candidates are: 
In file included from ../node_modules/nan/nan.h:25:0, 
       from ../node-stringprep.cc:1: 
/root/.node-gyp/4.4.7/include/node/node_buffer.h:31:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, v8::Local<v8::String>, node::encoding) <near match> 
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, 
             ^
/root/.node-gyp/4.4.7/include/node/node_buffer.h:31:40: note: no known conversion for argument 3 from ‘uint32_t {aka unsigned int}’ to ‘node::encoding’ 
/root/.node-gyp/4.4.7/include/node/node_buffer.h:43:40: note: v8::MaybeLocal<v8::Object> node::Buffer::New(v8::Isolate*, char*, size_t) <near match> 
NODE_EXTERN v8::MaybeLocal<v8::Object> New(v8::Isolate* isolate, 
             ^
/root/.node-gyp/4.4.7/include/node/node_buffer.h:43:40: note: no known conversion for argument 2 from ‘const char*’ to ‘char*’ 
In file included from ../node-stringprep.cc:1:0: 
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanNewBufferHandle(uint32_t)’: 
../node_modules/nan/nan.h:676:61: error: could not convert ‘node::Buffer::New(v8::Isolate::GetCurrent(), ((size_t)size))’ from ‘v8::MaybeLocal<v8::Object>’ to ‘v8::Local<v8::Object>’ 
    return node::Buffer::New(v8::Isolate::GetCurrent(), size); 
                  ^
../node_modules/nan/nan.h: In function ‘v8::Local<v8::Object> NanBufferUse(char*, uint32_t)’: 
../node_modules/nan/nan.h:683:12: error: ‘Use’ is not a member of ‘node::Buffer’ 
    return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size); 
      ^
make: *** [Release/obj.target/node_stringprep/node-stringprep.o] Error 1 
make: Leaving directory `/root/NodeJSCID/node_modules/node-stringprep/build' 
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2 
gyp ERR! stack  at ChildProcess.onExit (/root/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276: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-358.el6.x86_64 
gyp ERR! command "/root/.nvm/versions/node/v4.4.7/bin/node" "/root/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" 
gyp ERR! cwd /root/NodeJSCID/node_modules/node-stringprep 
gyp ERR! node -v v4.4.7 
gyp ERR! node-gyp -v v3.4.0 
gyp ERR! not ok 
npm ERR! Linux 2.6.32-358.el6.x86_64 
npm ERR! argv "/root/.nvm/versions/node/v4.4.7/bin/node" "/root/.nvm/versions/node/v4.4.7/bin/npm" "install" 
npm ERR! node v4.4.7 
npm ERR! npm v2.15.8 
npm ERR! code ELIFECYCLE 

npm ERR! [email protected] install: `node-gyp rebuild` 
npm ERR! Exit status 1 
npm ERR! 
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'. 
npm ERR! This is most likely a problem with the node-stringprep 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 information on how to open an issue for this project with: 
npm ERR!  npm bugs node-stringprep 
npm ERR! Or if that isn't available, you can get their info via: 
npm ERR! 
npm ERR!  npm owner ls node-stringprep 
npm ERR! There is likely additional logging output above. 

npm ERR! Please include the following file with any support request: 
npm ERR!  /root/NodeJSCID/npm-debug.log 

Antwort

0

Die Versionen von gcc und Python in CentOS 6 (und alle anderen 6.x Derivate RHEL) ist genug, um nicht den letzten Kompilierung Module mit der Version von Knoten zu unterstützen, die Sie verwenden. Wenn Sie node-gyp verwenden müssen, müssen Sie auf eine Version des Knotens < 4 downgraden oder SCL & devtoolset-3 installieren und sie dann aktivieren, bevor Sie npm install ausführen.

Es ist irreführend, da sie ein Repo für die letzten Knotenversionen auf EL6 hinzugefügt haben, aber sie funktionieren nicht aus der Box, wenn Sie etwas kompilieren müssen.

Edit: Um zu klären, auf devtoolset-3, die Sie benötigen centos-release-scl-rh, devtoolset-3-gcc-c++, devtoolset-3-binutils, & python27 zu installieren. Aktivieren Sie Devtoolset-3 (/opt/rh/devtoolset-3/enable) und Python 2.7 (/opt/rh/python27/enable). Sie sollten dann in der Lage sein, npm erfolgreich zu installieren. Die Aktivierung dieser Kerle dauert nur für die Dauer Ihrer Shell-Sitzung. Sie müssen dies also jedes Mal tun, wenn Sie sich anmelden oder zu Ihrem Bash-Profil hinzufügen.

+0

Ich habe es installiert und aktiviert, aber es funktioniert nicht immer noch Kompilierung Fehler –

+0

Bitte beachten Sie, dass das Problem nur mit dieser Version von CentOS ist. Der CentOS 7 mit 2015 GCC funktioniert perfekt mit diesem –

+0

Beachten Sie, dass 'scl enable devtoolset-3 bash' nur für die aktuelle Terminalsitzung gültig ist. Wenn/wenn Sie das Terminal verlassen, haben Sie wieder die gcc/g ++ - Standardversion 4.4.7. –