简体   繁体   English

运行 npm 安装时出现 kexec 错误

[英]Getting kexec error when running npm install

I started getting below error with node v12.22.7 and npm 6.14.15 (also tried with node v16.13.1 and npm v8.1.2 )我开始使用node v12.22.7npm 6.14.15错误(也尝试使用node v16.13.1npm 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.

Then I found this post which happens to be there is no support yet available for node 7 and above versions.然后我发现这篇 文章恰好是节点 7 及以上版本尚不支持。 So I downgraded to node v6.17.1 and npm v5.10.0 and got this error:所以我降级到node v6.17.1npm 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.

Then I check this post which mentions installing Command Lines Tools since I'm on Mac.然后我查看这篇文章,其中提到安装Command Lines Tools ,因为我在 Mac 上。 Though it was already installed, I uninstalled and reinstalled it with XCode Version 13.1 (13A1030d) and then ran xcode-select --install虽然它已经安装,但我卸载并使用XCode Version 13.1 (13A1030d)重新安装它,然后运行xcode-select --install

Other things I tried were: running npm cache clean --force , deleting node-modules and package-lock.json我尝试过的其他事情是:运行npm cache clean --force ,删除node-modulespackage-lock.json

After Referring to my organization's Jenkins pipeline I found that node 10 is used.在参考了我组织的 Jenkins 管道后,我发现使用了节点 10。

Installing node v10.24.1 and npm v6.14.12 fixed the problem but with the below kexec warnings.安装node v10.24.1npm 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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM