cat icon indicating copy to clipboard operation
cat copied to clipboard

node v14 及以上版本编译时报错的问题,怎么处理呢

Open SunGg12138 opened this issue 4 years ago • 3 comments

node v14 及以上版本编译时报错的问题,怎么处理呢

SunGg12138 avatar Sep 28 '21 00:09 SunGg12138

贴一下报错信息

zhisrc avatar Mar 02 '22 08:03 zhisrc

同问。好冷清啊,没有人维护了吗?

SH-shanchengyu-2:com-server shanchengyu$ npm i @dp-cat/client npm WARN deprecated [email protected]: this library is no longer supported npm WARN deprecated [email protected]: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details. npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142 npm ERR! code 1 npm ERR! path /Users/shanchengyu/Documents/branch/shengpay/UED/com-server/node_modules/@dp-cat/client npm ERR! command failed npm ERR! command sh -c node-gyp rebuild npm ERR! CXX(target) Release/obj.target/nodecat/src/nodecat.o npm ERR! gyp info it worked if it ends with ok npm ERR! gyp info using [email protected] npm ERR! gyp info using [email protected] | darwin | x64 npm ERR! gyp info find Python using Python version 3.9.0 found at "/Library/Frameworks/Python.framework/Versions/3.9/bin/python3" npm ERR! gyp info spawn /Library/Frameworks/Python.framework/Versions/3.9/bin/python3 npm ERR! gyp info spawn args [ npm ERR! gyp info spawn args '/Users/shanchengyu/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py', npm ERR! gyp info spawn args 'binding.gyp', npm ERR! gyp info spawn args '-f', npm ERR! gyp info spawn args 'make', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/shanchengyu/Documents/branch/shengpay/UED/com-server/node_modules/@dp-cat/client/build/config.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/shanchengyu/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', npm ERR! gyp info spawn args '-I', npm ERR! gyp info spawn args '/Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/common.gypi', npm ERR! gyp info spawn args '-Dlibrary=shared_library', npm ERR! gyp info spawn args '-Dvisibility=default', npm ERR! gyp info spawn args '-Dnode_root_dir=/Users/shanchengyu/Library/Caches/node-gyp/16.14.0', npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/shanchengyu/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp', npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/shanchengyu/Library/Caches/node-gyp/16.14.0/<(target_arch)/node.lib', npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/shanchengyu/Documents/branch/shengpay/UED/com-server/node_modules/@dp-cat/client', npm ERR! gyp info spawn args '-Dnode_engine=v8', npm ERR! gyp info spawn args '--depth=.', npm ERR! gyp info spawn args '--no-parallel', npm ERR! gyp info spawn args '--generator-output', npm ERR! gyp info spawn args 'build', npm ERR! gyp info spawn args '-Goutput_dir=.' npm ERR! gyp info spawn args ] npm ERR! gyp info spawn make npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ] npm ERR! ../src/nodecat.cc:18:58: error: no viable conversion from 'MaybeLocalv8::String' to 'Localv8::String' npm ERR! isolate->ThrowException(Exception::TypeError(String::NewFromUtf8(isolate, "Appkey is required"))); npm ERR! ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:200:7: note: candidate constructor (the implicit copy constructor) not viable: no known conversion from 'MaybeLocalv8::String' to 'const v8::Localv8::String &' for 1st argument npm ERR! class Local { npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:200:7: note: candidate constructor (the implicit move constructor) not viable: no known conversion from 'MaybeLocalv8::String' to 'v8::Localv8::String &&' for 1st argument npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:204:13: note: candidate template ignored: could not match 'Local' against 'MaybeLocal' npm ERR! V8_INLINE Local(Local<S> that) npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:348:22: note: explicit constructor is not a candidate npm ERR! explicit V8_INLINE Local(T* that) : val_(that) {} npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:7525:47: note: passing argument to parameter 'message' here npm ERR! static Local<Value> TypeError(Local<String> message); npm ERR! ^ npm ERR! ../src/nodecat.cc:21:49: error: too few arguments to function call, single argument 'context' was not specified npm ERR! String::Utf8Value str(args[0]->ToString()); npm ERR! ~~~~~~~~~~~~~~~~~ ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3048:44: note: 'ToString' declared here npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString( npm ERR! ^ npm ERR! ../src/nodecat.cc:21:27: error: no matching constructor for initialization of 'String::Utf8Value' npm ERR! String::Utf8Value str(args[0]->ToString()); npm ERR! ^ ~~~~~~~~~~~~~~~~~~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3588:5: note: candidate constructor not viable: no known conversion from 'MaybeLocalv8::String' to 'const v8::String::Utf8Value' for 1st argument npm ERR! Utf8Value(const Utf8Value&) = delete; npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:3581:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided npm ERR! Utf8Value(Isolate* isolate, Localv8::Value obj); npm ERR! ^ npm ERR! ../src/nodecat.cc:42:46: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value messageType((node->Get(String::NewFromUtf8(isolate, "messageType")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:44:43: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value type((node->Get(String::NewFromUtf8(isolate, "type")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:45:43: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value name((node->Get(String::NewFromUtf8(isolate, "name")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:46:45: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value status((node->Get(String::NewFromUtf8(isolate, "status")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:47:43: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value data((node->Get(String::NewFromUtf8(isolate, "data")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:48:34: error: no matching member function for call to 'Get' npm ERR! double begin = node->Get(String::NewFromUtf8(isolate, "beginTimestamp"))->NumberValue(); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:49:32: error: no matching member function for call to 'Get' npm ERR! double end = node->Get(String::NewFromUtf8(isolate, "endTimestamp"))->NumberValue(); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:58:13: error: no template named 'Handle' npm ERR! Handle<Array> children = Handle<Array>::Cast(node->Get(String::NewFromUtf8(isolate, "children"))); npm ERR! ^ npm ERR! ../src/nodecat.cc:58:38: error: no template named 'Handle' npm ERR! Handle<Array> children = Handle<Array>::Cast(node->Get(String::NewFromUtf8(isolate, "children"))); npm ERR! ^ npm ERR! ../src/nodecat.cc:58:64: error: no matching member function for call to 'Get' npm ERR! Handle<Array> children = Handle<Array>::Cast(node->Get(String::NewFromUtf8(isolate, "children"))); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:61:40: error: no template named 'Handle' npm ERR! InnerSendNode(isolate, Handle<Object>::Cast(children->Get(i))); npm ERR! ^ npm ERR! ../src/nodecat.cc:66:43: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value type((node->Get(String::NewFromUtf8(isolate, "type")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:67:43: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value name((node->Get(String::NewFromUtf8(isolate, "name")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:68:45: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value status((node->Get(String::NewFromUtf8(isolate, "status")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:69:43: error: no matching member function for call to 'Get' npm ERR! String::Utf8Value data((node->Get(String::NewFromUtf8(isolate, "data")))->ToString()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! ../src/nodecat.cc:70:33: error: no matching member function for call to 'Get' npm ERR! double begin((node->Get(String::NewFromUtf8(isolate, "beginTimestamp")))->NumberValue()); npm ERR! ~~~~~~^~~ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4007:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! /Users/shanchengyu/Library/Caches/node-gyp/16.14.0/include/node/v8.h:4010:43: note: candidate function not viable: requires 2 arguments, but 1 was provided npm ERR! V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context, npm ERR! ^ npm ERR! fatal error: too many errors emitted, stopping now [-ferror-limit=] npm ERR! 20 errors generated. npm ERR! make: *** [Release/obj.target/nodecat/src/nodecat.o] Error 1 npm ERR! gyp ERR! build error npm ERR! gyp ERR! stack Error: make failed with exit code: 2 npm ERR! gyp ERR! stack at ChildProcess.onExit (/Users/shanchengyu/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23) npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:520:28) npm ERR! gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12) npm ERR! gyp ERR! System Darwin 22.4.0 npm ERR! gyp ERR! command "/Users/shanchengyu/.nvm/versions/node/v16.14.0/bin/node" "/Users/shanchengyu/.nvm/versions/node/v16.14.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" npm ERR! gyp ERR! cwd /Users/shanchengyu/Documents/branch/shengpay/UED/com-server/node_modules/@dp-cat/client npm ERR! gyp ERR! node -v v16.14.0 npm ERR! gyp ERR! node-gyp -v v8.4.1 npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: npm ERR! /Users/shanchengyu/.npm/_logs/2023-06-15T09_44_07_025Z-debug-0.log

chennyshan avatar Jun 15 '23 09:06 chennyshan

最近nestjs项目遇到同样问题,已解决。 可以参考上面我提的cr。https://github.com/dianping/cat/pull/2308

xcyn avatar Aug 22 '23 03:08 xcyn