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 ...
随机推荐
- Asp.Net Mvc的几个小问题
突然想到一些小问题,对写代码影响不大,当是又很实用. MVC 中视图中的model的大小写问题,什么时候用大写,什么时候用小写? 所谓强类型视图,就是通过@model指令指明当前Model(属性)的具 ...
- P2704 [NOI2001]炮兵阵地
题目描述 司令部的将军们打算在N*M的网格地图上部署他们的炮兵部队.一个N*M的地图由N行M列组成,地图的每一格可能是山地(用“H” 表示),也可能是平原(用“P”表示),如下图.在每一格平原地形上最 ...
- 通过my.ini修改mysql默认编码为gbk
如何一次性修改后台显示语言为gbk 1. 找到my.ini(这是一个Mysql的配置文件) 1.1 要先打开显示隐藏文件的设置:https://jingyan.baidu.com/article/da ...
- MT【75】考察高斯函数的一道高考压轴题
解答:答案1,3,4. 这里关于高斯函数$[x]$的一个不等式是需要知道的$x-1<[x]\le x$,具体的:
- Java Socket/HttpURLConnection读取HTTP网页
以读取百度的http网页为例.如果知道了IP地址和端口,然后新建一个Socket,就直接去读百度的首页,根本没反应,原因是www.baidu.com是以http协议传输的,而现在要以Socket原始的 ...
- 如何整合Office Web Apps至自己开发的系统(一)
在前面我的一篇博客中 Office Web Apps安装部署(一),有一张介绍Office Web Apps与其他系统的关系图, 从上述图中,可知实际上Office Web Apps也是可以接入自 ...
- GO内存管理
TMalloc模型 http://www.360doc.com/content/16/0811/09/14513665_582407916.shtml http://blog.csdn.net/cho ...
- 【洛谷P1522】牛的旅行
题目大意:给定一个 N 个顶点的无向图,图中有若干联通块,现定义联通块的直径为该联通块中距离最远的两个点的距离,定义无向图的直径为这个图中所有联通块直径的最大值.现在在图上加一条边,使得两个本不连通的 ...
- Python基础学习(三)
了解了Python的基础使用,接下来继续练手廖雪峰老师的教学案例. 一.变量可以指向函数 说明,一个函数可以赋值给一个变量,该变量就会具有该函数的功能,举例: gg = abs print( gg(- ...
- centos下安装python3.6.2
一.下载 官网地址:https://www.python.org/downloads/source/ 我下载的是最新的3.6.2rc版本 # cd /opt/ wget https://www.pyt ...