码迷,mamicode.com
首页 > 其他好文 > 详细

node 使用笔记

时间:2014-07-02 21:06:00      阅读:342      评论:0      收藏:0      [点我收藏+]

标签:style   blog   http   java   使用   文件   

1 安装 buffertools

因为使用mjpeg-proxy的关系,需要编译buffertools中的C++代码文件,怎奈何一直出错。

 

make: Entering directory `/srv/node/SparkCore-WebApp/node_modules/buffertools/build‘
  CXX(target) Release/obj.target/buffertools/buffertools.o
../buffertools.cc: In member function ‘v8::Local<v8::Value><unnamed>::UnaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&)’:
../buffertools.cc:127: error: ‘EscapableHandleScope’ is not a member of ‘v8’
../buffertools.cc:127: error: expected ‘;’ before ‘handle_scope’
../buffertools.cc:138: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc:143: error: ‘handle_scope’ was not declared in this scope
../buffertools.cc: In member function ‘v8::Local<v8::Value><unnamed>::BinaryAction<Derived>::operator()(const v8::FunctionCallbackInfo<v8::Value>&)’:
../buffertools.cc:155: error: ‘EscapableHandleScope’ is not a member of ‘v8’
../buffertools.cc:155: error: expected ‘;’ before ‘handle_scope’
../buffertools.cc:166: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc:173: error: ‘handle_scope’ was not declared in this scope
../buffertools.cc:183: error: ‘handle_scope’ was not declared in this scope
../buffertools.cc:191: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc: In member function ‘v8::Local<v8::Value><unnamed>::FillAction::apply(v8::Local<v8::Object>, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:267: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc: In member function ‘v8::Local<v8::Value><unnamed>::EqualsAction::apply(v8::Local<v8::Object>, const uint8_t*, size_t, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:301: error: no matching function for call to ‘v8::Boolean::New(v8::Isolate*, bool)’
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:5931: note: candidates are: static v8::Handle<v8::Boolean> v8::Boolean::New(bool)
../buffertools.cc: In member function ‘v8::Local<v8::Value><unnamed>::CompareAction::apply(v8::Local<v8::Object>, const uint8_t*, size_t, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:311: error: invalid conversion from ‘v8::Isolate*’ to ‘int32_t’
../buffertools.cc:311: error:   initializing argument 1 of ‘static v8::Local<v8::Integer> v8::Integer::New(int32_t, v8::Isolate*)’
../buffertools.cc:311: error: invalid conversion from ‘int’ to ‘v8::Isolate*’
../buffertools.cc:311: error:   initializing argument 2 of ‘static v8::Local<v8::Integer> v8::Integer::New(int32_t, v8::Isolate*)’
../buffertools.cc: In member function ‘v8::Local<v8::Value><unnamed>::IndexOfAction::apply(v8::Local<v8::Object>, const uint8_t*, size_t, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:335: error: invalid conversion from ‘v8::Isolate*’ to ‘int32_t’
../buffertools.cc:335: error:   initializing argument 1 of ‘static v8::Local<v8::Integer> v8::Integer::New(int32_t, v8::Isolate*)’
../buffertools.cc:335: error: invalid conversion from ‘ptrdiff_t’ to ‘v8::Isolate*’
../buffertools.cc:335: error:   initializing argument 2 of ‘static v8::Local<v8::Integer> v8::Integer::New(int32_t, v8::Isolate*)’
../buffertools.cc: In function ‘v8::Local<v8::Value><unnamed>::decodeHex(const uint8_t*, size_t, const v8::FunctionCallbackInfo<v8::Value>&, uint32_t)’:
../buffertools.cc:358: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc:367: error: no matching function for call to ‘New(v8::Isolate*, long unsigned int)’
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:46: note: candidates are: v8::Local<v8::Object> node::Buffer::New(size_t)
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:48: note:                 v8::Local<v8::Object> node::Buffer::New(v8::Handle<v8::String>, node::encoding)
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:52: note:                 v8::Local<v8::Object> node::Buffer::New(const char*, size_t)
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:54: note:                 v8::Local<v8::Object> node::Buffer::New(char*, size_t, void (*)(char*, void*), void*)
../buffertools.cc:376: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc: In function ‘void<unnamed>::Concat(const v8::FunctionCallbackInfo<v8::Value>&)’:
../buffertools.cc:455: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
../buffertools.cc:459: error: no matching function for call to ‘New(v8::Isolate*, size_t&)’
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:46: note: candidates are: v8::Local<v8::Object> node::Buffer::New(size_t)
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:48: note:                 v8::Local<v8::Object> node::Buffer::New(v8::Handle<v8::String>, node::encoding)
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:52: note:                 v8::Local<v8::Object> node::Buffer::New(const char*, size_t)
/home/hu/.node-gyp/0.11.8/src/node_buffer.h:54: note:                 v8::Local<v8::Object> node::Buffer::New(char*, size_t, void (*)(char*, void*), void*)
../buffertools.cc:477: error: ‘class v8::Isolate’ has no member named ‘ThrowException’
make: *** [Release/obj.target/buffertools/buffertools.o] Error 1
make: Leaving directory `/srv/node/SparkCore-WebApp/node_modules/buffertools/build‘
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/hu/.nvm/v0.11.8/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:106:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:827:12)
gyp ERR! System Linux 2.6.32-358.6.2.el6.x86_64
gyp ERR! command "node" "/home/hu/.nvm/v0.11.8/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /srv/node/SparkCore-WebApp/node_modules/buffertools
gyp ERR! node -v v0.11.8
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok 
npm ERR! buffertools@2.1.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the buffertools@2.1.2 install script.
npm ERR! This is most likely a problem with the buffertools 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 buffertools
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-358.6.2.el6.x86_64
npm ERR! command "/home/hu/.nvm/v0.11.8/bin/node" "/home/hu/.nvm/v0.11.8/bin/npm" "install" "buffertools"
npm ERR! cwd /srv/node/SparkCore-WebApp
npm ERR! node -v v0.11.8
npm ERR! npm -v 1.3.13
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /srv/node/SparkCore-WebApp/npm-debug.log
npm ERR! not ok code 0

 

检查 g++ 版本

$ g++ -v
Using built-in specs.
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --with-java-home=/usr/lib/jvm/java-1.5.0-gcj-1.5.0.0/jre --enable-libgcj-multifile --enable-java-maintainer-mode --with-ecj-jar=/usr/share/java/eclipse-ecj.jar --disable-libjava-multilib --with-ppl --with-cloog --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.4.7 20120313 (Red Hat 4.4.7-4) (GCC) 

好吧,centos 自带版本实在太低,升级 g++ 版本

# /etc/yum.repos.d/DevToolset.repo
[DevToolset-2]
name=RedHat DevToolset v2 $releasever - $basearch
baseurl=http://puias.princeton.edu/data/puias/DevToolset/$releasever/$basearch/
enabled=1
gpgcheck=0

 

$ sudo yum install devtoolset-2
$ scl enable devtoolset-2 bash

$ g++ -v
Using built-in specs.
COLLECT_GCC=g++
COLLECT_LTO_WRAPPER=/opt/rh/devtoolset-2/root/usr/libexec/gcc/x86_64-redhat-linux/4.8.1/lto-wrapper
Target: x86_64-redhat-linux
Configured with: ../configure --prefix=/opt/rh/devtoolset-2/root/usr --mandir=/opt/rh/devtoolset-2/root/usr/share/man --infodir=/opt/rh/devtoolset-2/root/usr/share/info --with-bugurl=http://bugzilla.redhat.com/bugzilla --enable-bootstrap --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-gnu-unique-object --enable-linker-build-id --enable-languages=c,c++,fortran,lto --enable-plugin --with-linker-hash-style=gnu --enable-initfini-array --disable-libgcj --with-isl=/builddir/build/BUILD/gcc-4.8.1-20130715/obj-x86_64-redhat-linux/isl-install --with-cloog=/builddir/build/BUILD/gcc-4.8.1-20130715/obj-x86_64-redhat-linux/cloog-install --with-mpc=/builddir/build/BUILD/gcc-4.8.1-20130715/obj-x86_64-redhat-linux/mpc-install --with-tune=generic --with-arch_32=i686 --build=x86_64-redhat-linux
Thread model: posix
gcc version 4.8.1 20130715 (Red Hat 4.8.1-4) (GCC)

重新试试

 

$ npm install
npm http GET http://registry.cnpmjs.org/buffertools
npm http 304 http://registry.cnpmjs.org/buffertools

> buffertools@1.1.1 install /home/hu/node/node-mjpeg-proxy/node_modules/buffertools
> node-gyp rebuild

make: Entering directory `/home/hu/node/node-mjpeg-proxy/node_modules/buffertools/build‘
  CXX(target) Release/obj.target/buffertools/buffertools.o
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h: In member function ‘void v8::ReturnValue<T>::Set(uint32_t)‘:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:5780:31: warning: typedef ‘I‘ locally defined but not used [-Wunused-local-typedefs]
   typedef internal::Internals I;
                               ^
../buffertools.cc: At global scope:
../buffertools.cc:34:52: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope);
                                                    ^
../buffertools.cc:34:63: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope);
                                                               ^
../buffertools.cc:36:33: error: ‘Arguments‘ does not name a type
  Handle<Value> operator()(const Arguments& args) {
                                 ^
../buffertools.cc:36:44: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> operator()(const Arguments& args) {
                                            ^
../buffertools.cc: In member function ‘v8::Handle<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const int&)‘:
../buffertools.cc:39:29: error: request for member ‘This‘ in ‘args‘, which is of non-class type ‘const int‘
   Local<Object> self = args.This();
                             ^
../buffertools.cc: At global scope:
../buffertools.cc:50:86: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data, size_t size, const Arguments& args, HandleScope& scope);
                                                                                      ^
../buffertools.cc:50:97: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data, size_t size, const Arguments& args, HandleScope& scope);
                                                                                                 ^
../buffertools.cc:52:33: error: ‘Arguments‘ does not name a type
  Handle<Value> operator()(const Arguments& args) {
                                 ^
../buffertools.cc:52:44: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> operator()(const Arguments& args) {
                                            ^
../buffertools.cc: In member function ‘v8::Handle<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const int&)‘:
../buffertools.cc:55:29: error: request for member ‘This‘ in ‘args‘, which is of non-class type ‘const int‘
   Local<Object> self = args.This();
                             ^
../buffertools.cc:61:13: error: invalid types ‘const int[int]‘ for array subscript
   if (args[0]->IsString()) {
             ^
../buffertools.cc:62:30: error: invalid types ‘const int[int]‘ for array subscript
    String::Utf8Value s(args[0]->ToString());
                              ^
../buffertools.cc:65:33: error: invalid types ‘const int[int]‘ for array subscript
   if (Buffer::HasInstance(args[0])) {
                                 ^
../buffertools.cc:66:32: error: invalid types ‘const int[int]‘ for array subscript
    Local<Object> other = args[0]->ToObject();
                                ^
../buffertools.cc: At global scope:
../buffertools.cc:119:52: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                    ^
../buffertools.cc:119:63: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                               ^
../buffertools.cc:125:52: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                    ^
../buffertools.cc:125:63: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                               ^
../buffertools.cc: In member function ‘v8::Handle<v8::Value> {anonymous}::FillAction::apply(v8::Handle<v8::Object>&, const int&, v8::HandleScope&)‘:
../buffertools.cc:126:13: error: invalid types ‘const int[int]‘ for array subscript
   if (args[0]->IsInt32()) {
             ^
../buffertools.cc:127:18: error: invalid types ‘const int[int]‘ for array subscript
    int c = args[0]->ToInt32()->Int32Value();
                  ^
../buffertools.cc:131:13: error: invalid types ‘const int[int]‘ for array subscript
   if (args[0]->IsString()) {
             ^
../buffertools.cc:132:30: error: invalid types ‘const int[int]‘ for array subscript
    String::Utf8Value s(args[0]->ToString());
                              ^
../buffertools.cc:136:33: error: invalid types ‘const int[int]‘ for array subscript
   if (Buffer::HasInstance(args[0])) {
                                 ^
../buffertools.cc:137:33: error: invalid types ‘const int[int]‘ for array subscript
    Handle<Object> other = args[0]->ToObject();
                                 ^
../buffertools.cc: At global scope:
../buffertools.cc:152:52: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                    ^
../buffertools.cc:152:63: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                               ^
../buffertools.cc:164:86: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data, size_t size, const Arguments& args, HandleScope& scope) {
                                                                                      ^
../buffertools.cc:164:97: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data, size_t size, const Arguments& args, HandleScope& scope) {
                                                                                                 ^
../buffertools.cc:170:86: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data, size_t size, const Arguments& args, HandleScope& scope) {
                                                                                      ^
../buffertools.cc:170:97: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data, size_t size, const Arguments& args, HandleScope& scope) {
                                                                                                 ^
../buffertools.cc:176:88: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data2, size_t size2, const Arguments& args, HandleScope& scope) {
                                                                                        ^
../buffertools.cc:176:99: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const uint8_t* data2, size_t size2, const Arguments& args, HandleScope& scope) {
                                                                                                   ^
../buffertools.cc: In member function ‘v8::Handle<v8::Value> {anonymous}::IndexOfAction::apply(v8::Handle<v8::Object>&, const uint8_t*, size_t, const int&, v8::HandleScope&)‘:
../buffertools.cc:180:25: error: invalid types ‘const int[int]‘ for array subscript
   int32_t start = args[1]->Int32Value();
                         ^
../buffertools.cc: At global scope:
../buffertools.cc:209:84: error: ‘Arguments‘ does not name a type
 inline Handle<Value> decodeHex(const uint8_t* const data, const size_t size, const Arguments& args, HandleScope& scope) {
                                                                                    ^
../buffertools.cc:209:95: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 inline Handle<Value> decodeHex(const uint8_t* const data, const size_t size, const Arguments& args, HandleScope& scope) {
                                                                                               ^
../buffertools.cc: In function ‘v8::Handle<v8::Value> {anonymous}::decodeHex(const uint8_t*, size_t, const int&, v8::HandleScope&)‘:
../buffertools.cc:219:50: error: ‘class v8::Object‘ has no member named ‘handle_‘
  Handle<Object>& buffer = Buffer::New(size / 2)->handle_;
                                                  ^
../buffertools.cc: At global scope:
../buffertools.cc:240:52: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                    ^
../buffertools.cc:240:63: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                               ^
../buffertools.cc:248:52: error: ‘Arguments‘ does not name a type
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                    ^
../buffertools.cc:248:63: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
  Handle<Value> apply(Handle<Object>& buffer, const Arguments& args, HandleScope& scope) {
                                                               ^
../buffertools.cc:270:27: error: ‘Arguments‘ does not name a type
 Handle<Value> Clear(const Arguments& args) {
                           ^
../buffertools.cc:270:38: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> Clear(const Arguments& args) {
                                      ^
../buffertools.cc:274:26: error: ‘Arguments‘ does not name a type
 Handle<Value> Fill(const Arguments& args) {
                          ^
../buffertools.cc:274:37: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> Fill(const Arguments& args) {
                                     ^
../buffertools.cc:278:29: error: ‘Arguments‘ does not name a type
 Handle<Value> Reverse(const Arguments& args) {
                             ^
../buffertools.cc:278:40: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> Reverse(const Arguments& args) {
                                        ^
../buffertools.cc:282:28: error: ‘Arguments‘ does not name a type
 Handle<Value> Equals(const Arguments& args) {
                            ^
../buffertools.cc:282:39: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> Equals(const Arguments& args) {
                                       ^
../buffertools.cc:286:29: error: ‘Arguments‘ does not name a type
 Handle<Value> Compare(const Arguments& args) {
                             ^
../buffertools.cc:286:40: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> Compare(const Arguments& args) {
                                        ^
../buffertools.cc:290:29: error: ‘Arguments‘ does not name a type
 Handle<Value> IndexOf(const Arguments& args) {
                             ^
../buffertools.cc:290:40: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> IndexOf(const Arguments& args) {
                                        ^
../buffertools.cc:294:29: error: ‘Arguments‘ does not name a type
 Handle<Value> FromHex(const Arguments& args) {
                             ^
../buffertools.cc:294:40: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> FromHex(const Arguments& args) {
                                        ^
../buffertools.cc:298:27: error: ‘Arguments‘ does not name a type
 Handle<Value> ToHex(const Arguments& args) {
                           ^
../buffertools.cc:298:38: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> ToHex(const Arguments& args) {
                                      ^
../buffertools.cc:302:28: error: ‘Arguments‘ does not name a type
 Handle<Value> Concat(const Arguments& args) {
                            ^
../buffertools.cc:302:39: error: ISO C++ forbids declaration of ‘args‘ with no type [-fpermissive]
 Handle<Value> Concat(const Arguments& args) {
                                       ^
../buffertools.cc: In function ‘v8::Handle<v8::Value> {anonymous}::Concat(const int&)‘:
../buffertools.cc:303:14: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
  HandleScope scope;
              ^
../buffertools.cc:303:14: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc:306:36: error: request for member ‘Length‘ in ‘args‘, which is of non-class type ‘const int‘
  for (int index = 0, length = args.Length(); index < length; ++index) {
                                    ^
../buffertools.cc:307:32: error: invalid types ‘const int[int]‘ for array subscript
   Local<Value> arg = args[index];
                                ^
../buffertools.cc:324:8: error: expected primary-expression before ‘&‘ token
  Buffer& dst = *Buffer::New(size);
        ^
../buffertools.cc:324:10: error: ‘dst‘ was not declared in this scope
  Buffer& dst = *Buffer::New(size);
          ^
../buffertools.cc:327:36: error: request for member ‘Length‘ in ‘args‘, which is of non-class type ‘const int‘
  for (int index = 0, length = args.Length(); index < length; ++index) {
                                    ^
../buffertools.cc:328:32: error: invalid types ‘const int[int]‘ for array subscript
   Local<Value> arg = args[index];
                                ^
../buffertools.cc: In function ‘void {anonymous}::RegisterModule(v8::Handle<v8::Object>)‘:
../buffertools.cc:352:72: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("concat"),  FunctionTemplate::New(Concat)->GetFunction());
                                                                        ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:353:70: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("fill"),    FunctionTemplate::New(Fill)->GetFunction());
                                                                      ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:354:71: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("clear"),   FunctionTemplate::New(Clear)->GetFunction());
                                                                       ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:355:73: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("reverse"), FunctionTemplate::New(Reverse)->GetFunction());
                                                                         ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:356:72: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("equals"),  FunctionTemplate::New(Equals)->GetFunction());
                                                                        ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:357:73: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("compare"), FunctionTemplate::New(Compare)->GetFunction());
                                                                         ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:358:73: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("indexOf"), FunctionTemplate::New(IndexOf)->GetFunction());
                                                                         ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:359:73: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("fromHex"), FunctionTemplate::New(FromHex)->GetFunction());
                                                                         ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc:360:71: error: invalid conversion from ‘v8::Handle<v8::Value> (*)(const int&)‘ to ‘v8::FunctionCallback {aka void (*)(const v8::FunctionCallbackInfo<v8::Value>&)}‘ [-fpermissive]
  target->Set(String::NewSymbol("toHex"),   FunctionTemplate::New(ToHex)->GetFunction());
                                                                       ^
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:3311:34: error:   initializing argument 1 of ‘static v8::Local<v8::FunctionTemplate> v8::FunctionTemplate::New(v8::FunctionCallback, v8::Handle<v8::Value>, v8::Handle<v8::Signature>, int)‘ [-fpermissive]
   static Local<FunctionTemplate> New(
                                  ^
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::ClearAction]‘:
../buffertools.cc:271:27:   required from here
../buffertools.cc:37:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:37:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::FillAction]‘:
../buffertools.cc:275:26:   required from here
../buffertools.cc:37:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:37:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::ReverseAction]‘:
../buffertools.cc:279:29:   required from here
../buffertools.cc:37:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:37:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::EqualsAction]‘:
../buffertools.cc:283:28:   required from here
../buffertools.cc:53:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:53:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::CompareAction]‘:
../buffertools.cc:287:29:   required from here
../buffertools.cc:53:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:53:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::BinaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::IndexOfAction]‘:
../buffertools.cc:291:29:   required from here
../buffertools.cc:53:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:53:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::FromHexAction]‘:
../buffertools.cc:295:29:   required from here
../buffertools.cc:37:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:37:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In instantiation of ‘v8::Handle<v8::Value> {anonymous}::UnaryAction<Derived>::operator()(const int&) [with Derived = {anonymous}::ToHexAction]‘:
../buffertools.cc:299:27:   required from here
../buffertools.cc:37:15: error: no matching function for call to ‘v8::HandleScope::HandleScope()‘
   HandleScope scope;
               ^
../buffertools.cc:37:15: note: candidates are:
In file included from ../buffertools.cc:16:0:
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note: v8::HandleScope::HandleScope(const v8::HandleScope&)
   HandleScope(const HandleScope&);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:783:3: note:   candidate expects 1 argument, 0 provided
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note: v8::HandleScope::HandleScope(v8::Isolate*)
   HandleScope(Isolate* isolate);
   ^
/home/hu/.node-gyp/0.11.8/deps/v8/include/v8.h:756:3: note:   candidate expects 1 argument, 0 provided
../buffertools.cc: In function ‘v8::Handle<v8::Value> {anonymous}::Concat(const int&)‘:
../buffertools.cc:349:1: warning: control reaches end of non-void function [-Wreturn-type]
 }
 ^
make: *** [Release/obj.target/buffertools/buffertools.o] Error 1
make: Leaving directory `/home/hu/node/node-mjpeg-proxy/node_modules/buffertools/build‘
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/hu/.nvm/v0.11.8/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:106:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:827:12)
gyp ERR! System Linux 2.6.32-358.6.2.el6.x86_64
gyp ERR! command "node" "/home/hu/.nvm/v0.11.8/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/hu/node/node-mjpeg-proxy/node_modules/buffertools
gyp ERR! node -v v0.11.8
gyp ERR! node-gyp -v v0.11.0
gyp ERR! not ok 
npm ERR! buffertools@1.1.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the buffertools@1.1.1 install script.
npm ERR! This is most likely a problem with the buffertools 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 buffertools
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-358.6.2.el6.x86_64
npm ERR! command "/home/hu/.nvm/v0.11.8/bin/node" "/home/hu/.nvm/v0.11.8/bin/npm" "install"
npm ERR! cwd /home/hu/node/node-mjpeg-proxy
npm ERR! node -v v0.11.8
npm ERR! npm -v 1.3.13
npm ERR! code ELIFECYCLE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/hu/node/node-mjpeg-proxy/npm-debug.log
npm ERR! not ok code 0

v8 版本不匹配,安装一个0.10.29试试。

npm install
 
> buffertools@1.1.1 install /home/hu/node/node-mjpeg-proxy/node_modules/buffertools
> node-gyp rebuild

make: Entering directory `/home/hu/node/node-mjpeg-proxy/node_modules/buffertools/build‘
  CXX(target) Release/obj.target/buffertools/buffertools.o
  SOLINK_MODULE(target) Release/obj.target/buffertools.node
  SOLINK_MODULE(target) Release/obj.target/buffertools.node: Finished
  COPY Release/buffertools.node
make: Leaving directory `/home/hu/node/node-mjpeg-proxy/node_modules/buffertools/build‘
buffertools@1.1.1 node_modules/buffertools

至此安装成功了。结论是不仅要匹配g++版本,也需要匹配v8版本。

  

node 使用笔记,布布扣,bubuko.com

node 使用笔记

标签:style   blog   http   java   使用   文件   

原文地址:http://www.cnblogs.com/huys03/p/3819167.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!