[英]Getting kexec error when running npm install
我開始使用node v12.22.7
和npm 6.14.15
錯誤(也嘗試使用node v16.13.1
和npm v8.1.2
)
> node-gyp rebuild
CXX(target) Release/obj.target/kexec/src/kexec.o
../src/kexec.cc:19:11: error: no member named 'Handle' in namespace 'v8'
using v8::Handle;
~~~~^
../src/kexec.cc:68:27: error: no matching constructor for initialization of 'String::Utf8Value'
String::Utf8Value str(info[0]);
^ ~~~~~~~
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:3142:5: note: candidate constructor not viable: no known conversion from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value' for 1st argument
Utf8Value(const Utf8Value&) = delete;
^
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:3135:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
^
../src/kexec.cc:78:27: error: no matching constructor for initialization of 'String::Utf8Value'
String::Utf8Value str(info[0]);
^ ~~~~~~~
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:3142:5: note: candidate constructor not viable: no known conversion from 'v8::Local<v8::Value>' to 'const v8::String::Utf8Value' for 1st argument
Utf8Value(const Utf8Value&) = delete;
^
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:3135:5: note: candidate constructor not viable: requires 2 arguments, but 1 was provided
Utf8Value(Isolate* isolate, Local<v8::Value> obj);
^
../src/kexec.cc:91:75: error: no matching member function for call to 'ToString'
String::Utf8Value arg(argv_handle->Get(Nan::New<Integer>(i))->ToString());
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:2668:44: note: candidate function not viable: requires single argument 'context', but no arguments were provided
V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(
^
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:2684:31: note: candidate function not viable: requires single argument 'isolate', but no arguments were provided
Local<String> ToString(Isolate* isolate) const);
^
../src/kexec.cc:91:48: warning: 'Get' is deprecated: Use maybe version [-Wdeprecated-declarations]
String::Utf8Value arg(argv_handle->Get(Nan::New<Integer>(i))->ToString());
^
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:3553:3: note: 'Get' has been explicitly marked deprecated here
V8_DEPRECATED("Use maybe version", Local<Value> Get(Local<Value> key));
^
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8config.h:328:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated(message)))
^
../src/kexec.cc:115:12: error: no template named 'Handle'
void init (Handle<Object> exports) {
^
../src/kexec.cc:116:5: error: too few arguments to function call, single argument 'context' was not specified
EXPORT("kexec", kexec);
^~~~~~~~~~~~~~~~~~~~~~
../src/kexec.cc:112:51: note: expanded from macro 'EXPORT'
Nan::New<FunctionTemplate>(symbol)->GetFunction() \
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^
/Users/username/Library/Caches/node-gyp/12.22.7/include/node/v8.h:6126:46: note: 'GetFunction' declared here
V8_WARN_UNUSED_RESULT MaybeLocal<Function> GetFunction(
^
1 warning and 6 errors generated.
make: *** [Release/obj.target/kexec/src/kexec.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/username/.nvm/versions/node/v12.22.7/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:314:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:276:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/username/.nvm/versions/node/v12.22.7/bin/node" "/Users/username/.nvm/versions/node/v12.22.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/username/Documents/Workspace/Code/projectname/node_modules/kexec
gyp ERR! node -v v12.22.7
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN inquirer-autocomplete-prompt-ipt@2.0.0 requires a peer of inquirer@>=7 but none is installed. You must install peer dependencies yourself.
npm WARN inquirer-ordinal-prompt@1.0.0 requires a peer of inquirer@>= 7 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-config-recommended@1.0.0 requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-config-standard@17.0.0 requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN zipkin-instrumentation-express@0.16.2 requires a peer of @types/express@^4.0.39 but none is installed. You must install peer dependencies yourself.
npm WARN projectname@0.0.245 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! kexec@3.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kexec@3.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
然后我發現這篇 文章恰好是節點 7 及以上版本尚不支持。 所以我降級到node v6.17.1
和npm v5.10.0
並得到這個錯誤:
> kexec@3.0.0 install /Users/username/Documents/Workspace/Code/projectname/node_modules/kexec
> node-gyp rebuild
CXX(target) Release/obj.target/kexec/src/kexec.o
clang: warning: include path for libstdc++ headers not found; pass '-stdlib=libc++' on the command line to use the libc++ standard library instead [-Wstdlibcxx-not-found]
../src/kexec.cc:1:10: fatal error: 'cstdio' file not found
#include <cstdio>
^~~~~~~~
1 error generated.
make: *** [Release/obj.target/kexec/src/kexec.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/username/.nvm/versions/node/v6.17.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack at ChildProcess.emit (events.js:191:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:219:12)
gyp ERR! System Darwin 20.6.0
gyp ERR! command "/Users/username/.nvm/versions/node/v6.17.1/bin/node" "/Users/username/.nvm/versions/node/v6.17.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/username/Documents/Workspace/Code/projectname/node_modules/kexec
gyp ERR! node -v v6.17.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN inquirer-autocomplete-prompt-ipt@2.0.0 requires a peer of inquirer@>=7 but none is installed. You must install peer dependencies yourself.
npm WARN inquirer-ordinal-prompt@1.0.0 requires a peer of inquirer@>= 7 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-config-recommended@1.0.0 requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-config-standard@17.0.0 requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN zipkin-instrumentation-express@0.16.2 requires a peer of @types/express@^4.0.39 but none is installed. You must install peer dependencies yourself.
npm WARN projectname@0.0.245 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! kexec@3.0.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the kexec@3.0.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
然后我查看這篇文章,其中提到安裝Command Lines Tools
,因為我在 Mac 上。 雖然它已經安裝,但我卸載並使用XCode Version 13.1 (13A1030d)
重新安裝它,然后運行xcode-select --install
我嘗試過的其他事情是:運行npm cache clean --force
,刪除node-modules
和package-lock.json
在參考了我組織的 Jenkins 管道后,我發現使用了節點 10。
安裝node v10.24.1
和npm v6.14.12
解決了問題,但出現以下 kexec 警告。
> kexec@3.0.0 install /Users/username/Documents/Workspace/Code/projectname/node_modules/kexec
> node-gyp rebuild
CXX(target) Release/obj.target/kexec/src/kexec.o
../src/kexec.cc:68:27: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
String::Utf8Value str(info[0]);
^
/Users/username/Library/Caches/node-gyp/10.24.1/include/node/v8.h:2891:5: note: 'Utf8Value' has been explicitly marked deprecated here
V8_DEPRECATED("Use Isolate version",
^
/Users/username/Library/Caches/node-gyp/10.24.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated))
^
../src/kexec.cc:78:27: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
String::Utf8Value str(info[0]);
^
/Users/username/Library/Caches/node-gyp/10.24.1/include/node/v8.h:2891:5: note: 'Utf8Value' has been explicitly marked deprecated here
V8_DEPRECATED("Use Isolate version",
^
/Users/username/Library/Caches/node-gyp/10.24.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated))
^
../src/kexec.cc:91:31: warning: 'Utf8Value' is deprecated [-Wdeprecated-declarations]
String::Utf8Value arg(argv_handle->Get(Nan::New<Integer>(i))->ToString());
^
/Users/username/Library/Caches/node-gyp/10.24.1/include/node/v8.h:2891:5: note: 'Utf8Value' has been explicitly marked deprecated here
V8_DEPRECATED("Use Isolate version",
^
/Users/username/Library/Caches/node-gyp/10.24.1/include/node/v8config.h:327:29: note: expanded from macro 'V8_DEPRECATED'
declarator __attribute__((deprecated))
^
3 warnings generated.
SOLINK_MODULE(target) Release/kexec.node
npm notice created a lockfile as package-lock.json. You should commit this file.
added 1 package from 1 contributor and audited 1286 packages in 13.916s
113 packages are looking for funding
run `npm fund` for details
found 36 vulnerabilities (27 moderate, 9 high)
run `npm audit fix` to fix them, or `npm audit` for details
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.