Home > Mobile >  Getting kexec error when running npm install
Getting kexec error when running npm install

Time:12-09

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-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 [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of inquirer@>=7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of inquirer@>= 7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @types/express@^4.0.39 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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. So I downgraded to node v6.17.1 and npm v5.10.0 and got this error:

> [email protected] 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 [email protected] requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of inquirer@>=7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of inquirer@>= 7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of stylelint@^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @types/express@^4.0.39 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] 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. Though it was already installed, I uninstalled and reinstalled it with XCode Version 13.1 (13A1030d) and then ran xcode-select --install

Other things I tried were : running npm cache clean --force , deleting node-modules and package-lock.json

CodePudding user response:

After Referring to my organization's Jenkins pipeline I found that node 10 is used.

Installing node v10.24.1 and npm v6.14.12 fixed the problem but with the below kexec warnings.

> [email protected] 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
  • Related