node 使用笔记
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 使用笔记的更多相关文章
- node 学习笔记
以下笔记默认安装完成node 及npm 1.安装express 新版本的express-generator已经独立出来,全局安装这个包就ok. npm install express-generato ...
- node学习笔记-搭建node环境
最近项目要用到node,利用空闲整理做下笔记 第一步 安装node,方式比较多,最为直接的是直接去官网 可直接从官网下载安装http://nodejs.cn/download/ 根据自己情况 ...
- Node.js笔记1
Node.js入门笔记 1. node -help 可以显示帮助信息2. node REPL 模式(Read-eval-print loop) 输入—求值—输出循环 直接在cmd输入node 可以进入 ...
- node学习笔记(二)(ajax方式向node后台提交数据)
通过ajax向node后台提交数据过程(附手写前后台代码),并总结post与get的区别 POST 前台代码 //CSS简单给点样式 <style> form{ width: 200px; ...
- node.js 笔记
教程总结笔记: 学习网站:http://www.runoob.com/nodejs/nodejs-install-setup.html Node.js 中文网及安装文件下载: http://nodej ...
- Nodejs全站开发学习系列 & 深入浅出Node学习笔记 & Spider抓取
https://course.tianmaying.com/node 这个系列的文章看起来很不错,值得学习一下. /Users/baidu/Documents/Data/Interview/Web-S ...
- node学习笔记(连载)
这段时间玩了小程序.浏览器插件.koa建站,本来想写几篇文章总结一下的.迫于工作上有新需求要跟进,所以先写写读书笔记吧.公司九点上班,不过弹性工作时间,大家基本上九点半之前到.而我作为渣渣,八点半就到 ...
- Node.js 笔记02
一.关于命令 常用命令: dir 列出当前目录下面所有的文件 cd 目录名 进入到指定的目录,. 当前目录, .. 进入上级目录,cd . 当前目录, cd .. 上级目录 md 目录名 创建文件夹 ...
- node.js 笔记(一)
参考:https://github.com/alsotang/node-lessons 感谢!!! 本文属于小白入门级笔记,请大牛自动屏蔽!!! 1. 开发环境 os: 10.12.6 nod ...
- node学习笔记(一)本地文件目录查看器
Node.js 新闻 nw.js 前端开发桌面应用 内容 node.js实战 照例提供百度云链接,本来以为是实战系列的那本,但不是,不过这本也不错 链接:https://pan.baidu.com/s ...
随机推荐
- NOI前各种Idea总结以及各种文本乱堆
转载请注明原文地址:https://www.cnblogs.com/LadyLex/p/9227267.html 不过这篇的确没什么*用了转转吧 2018-6-24 关于一类延迟标记(来自UR14 思 ...
- 【刷题】BZOJ 4176 Lucas的数论
Description 去年的Lucas非常喜欢数论题,但是一年以后的Lucas却不那么喜欢了. 在整理以前的试题时,发现了这样一道题目"求Sigma(f(i)),其中1<=i< ...
- 【转】树莓派Raspberry Pi - 还原已经装过系统的TF卡
想给树莓派换个系统的话,需要先把已经装过系统的TF卡进行还原,这里使用最简单粗暴无脑的方法: 1,下载安装Win32 Disk Imager(一般已经装过一次系统后,这个东西都有) 2,下载boots ...
- 界面编程之QT的事件20180727
/*******************************************************************************************/ 一.事件 1 ...
- ELK logstash 处理MySQL慢查询日志
在生产环境下,logstash 经常会遇到处理多种格式的日志,不同的日志格式,解析方法不同.下面来说说logstash处理多行日志的例子,对MySQL慢查询日志进行分析,这个经常遇到过,网络上疑问也很 ...
- spring cloud微服务架构 服务提供者和服务消费者
服务提供者和服务消费者 下面这张表格,简单描述了服务提供者/消费者是什么: | 名词 | 概念 | | ----- | ----------------------- | | 服务提供者 | 服务 ...
- A*算法–A* algorithm tutorial
Author:Justin Heyes-Jones From: http://heyes-jones.com/astar.php Date:2014.8.16 本文地址:http://www.cnbl ...
- 那些年的 网络通信之 TCP/IP 传输控制协议 ip 加 端口 客户端上传文件到服务器端服务器端返回上传成功消息
多线程开启, 客户端通过 Socket 流 上传文件到服务端的一个小程序练习. 1. 抓住阻塞式方法,去调试 2. 获取对应流对象操作对应的对象 这时候自己不能懵,一定要清晰,最好命名就能区别,一搞混 ...
- [软件]Xcode查找系统framework所在路径
有的时候, 我们不小心改了头文件, 导致Xcode系统库被修改(改回去也不行) 假设我改的是UIKit.framework类库里面的一个文件, 那么你只需要从另一个好使的电脑上, 在这个路径找到UIK ...
- [BZOJ 2299][HAOI 2011]向量 题解(裴蜀定理)
[BZOJ 2299][HAOI 2011]向量 Description 给你一对数a,b,你可以任意使用(a,b), (a,-b), (-a,b), (-a,-b), (b,a), (b,-a), ...