Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node-gyp: Error: make failed with exit code: 2 #494

Closed
blackcheep11 opened this issue Feb 21, 2020 · 6 comments
Closed

node-gyp: Error: make failed with exit code: 2 #494

blackcheep11 opened this issue Feb 21, 2020 · 6 comments

Comments

@blackcheep11
Copy link

Hi

while i try to install the java module on my nodejs (currently running the lts v12) i get this error

I also got a thread on stackoverflow but they told me to repost it here. https://stackoverflow.com/questions/60323778/node-gyp-error-make-failed-with-exit-code-2

I am a newbee on this sector so please be gentle. I tried realy hard to solve this problem by searching on google.

  • I installed nvm to test different version
  • I installed the xcode command line tool
  • i created a .bashprofile (or so)
  • i als modified an ini file to accept JNI
  • i also did some other things i do not remember yet. I spend 2 days on this subject so any help is really appreciated

4 warnings generated. SOLINK_MODULE(target) Release/nodejavabridge_bindings.node ld: library not found for -ljli clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [Release/nodejavabridge_bindings.node] Error 1 gyp ERR! build error gyp ERR! stack Error: make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/bob/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:311:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.3.0
gyp ERR! command "/Users/bob/.nvm/versions/node/v12.16.1/bin/node" "/Users/bob/.nvm/versions/node/v12.16.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/bob/Documents/node-synfis-backend/node_modules/java
gyp ERR! node -v v12.16.1
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm WARN synfis-backend@0.9.1 No description
npm WARN synfis-backend@0.9.1 No repository field.
npm WARN The package @types/fs-extra is included as both a dev and production dependency.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java@0.12.1 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the java@0.12.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/bob/.npm/_logs/2020-02-21T08_10_18_068Z-debug.log`

@blackcheep11
Copy link
Author

blackcheep11 commented Feb 24, 2020

I just tried to install it on a blank directory. Just in case there is a conflict with any of my other installed modules.

I got the same result/error

@danbrackettHBO
Copy link

Hi I can confirm that I too have received the same error messaging.
I read up on the issue #90 page. but there isn't a more recent update as of April, 2019.

npm install -g java

> java@0.12.1 install /Users/dbracket/.nvm/versions/node/v12.13.1/lib/node_modules/java
> node-gyp rebuild

  CXX(target) Release/obj.target/nodejavabridge_bindings/src/java.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaObject.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/javaScope.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/methodCallBaton.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/nodeJavaBridge.o
  CXX(target) Release/obj.target/nodejavabridge_bindings/src/utils.o
../src/utils.cpp:455:5: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
    ((v8::Object*)*v8ex)->Set(Nan::GetCurrentContext(), Nan::New<v8::String>("cause").ToLocalChecked(), javaToV8(java, env, ex));
    ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/utils.cpp:642:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        result->Set(Nan::GetCurrentContext(), i, JavaObject::New(java, obj));
        ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/utils.cpp:652:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        result->Set(Nan::GetCurrentContext(), i, item);
        ^~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../src/utils.cpp:715:9: warning: ignoring return value of function declared with 'warn_unused_result' attribute [-Wunused-result]
        v8ResultNumberObject->Set(Nan::GetCurrentContext(), Nan::New<v8::String>("longValue").ToLocalChecked(), Nan::New<v8::String>(strValue.c_str()).ToLocalChecked());
        ^~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
4 warnings generated.
  SOLINK_MODULE(target) Release/nodejavabridge_bindings.node
ld: warning: directory not found for option '-L/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home/lib/jli'
ld: library not found for -ljli
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Release/nodejavabridge_bindings.node] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/dbracket/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:210:5)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 18.7.0
gyp ERR! command "/Users/dbracket/.nvm/versions/node/v12.13.1/bin/node" "/Users/dbracket/.nvm/versions/node/v12.13.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/dbracket/.nvm/versions/node/v12.13.1/lib/node_modules/java
gyp ERR! node -v v12.13.1
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok 
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! java@0.12.1 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the java@0.12.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

@blackcheep11
Copy link
Author

I could make it work by downgrading to JVA 1.8..

I guess the problem is that after 1.10 they deleted the "jre/lib/ext" dir

@dannycdannydo
Copy link

Getting the exact same issue. I'm a bit new to this. When you say downgrading to JVA 1.8 do you mean you downgraded your java to 0.8.0? I have just done so but getting the same issue.

npm ERR! java@0.8.0 install: node-gyp rebuild

@blackcheep11
Copy link
Author

Getting the exact same issue. I'm a bit new to this. When you say downgrading to JVA 1.8 do you mean you downgraded your java to 0.8.0? I have just done so but getting the same issue.

npm ERR! java@0.8.0 install: node-gyp rebuild

Hi i just downloaded this file : jdk-8u241-macosx-x64.dmg

a quick google search should do the job

@blackcheep11
Copy link
Author

Solved by downgrading to jdk-8u241-macosx-x64

java -version results in

java version "1.8.0_241"
Java(TM) SE Runtime Environment (build 1.8.0_241-b07)
Java HotSpot(TM) 64-Bit Server VM (build 25.241-b07, mixed mode)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants