You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Seems like perhaps JAVA_HOME may not being discovered properly. I'd try manually setting that, and if that still doesn't work, mucking with binging.gyp line ~130 until you can resolve the issue.
I was having the same issue as Jamund and I've managed to work around it. The solution seems to be setting the JAVA_HOME env variable. I also updated to 1.7.0_45 but I'm not sure that had any effect on finding the solution.
In talking with a few other folks who have Mavericks and did not have this issue, it appears that if you had 1.7.0_45 before upgrading to Mavericks the issue doesn't appear. After Mavericks the JDK installer no longer appears to update the current_jdk link. So, the only way to solve the issue is to set JAVA_HOME or update the link to point to the latest JDK.
I was experiencing a similar issue, although the file that couldn't be found was jni_md.h. Turns out, if you're using jenv (https://github.com/gcuisinier/jenv), because it uses a shim and symlink for JAVA_HOME, node-java will resolve the path to "Users" not "Library" and therefore won't include the extra darwin subdirectory (where jni_md.h is located).
I'm using jenvand run into the exactly same problem @nselikoff mentioned above.
My current workaround is copy jni_md.h and jawt_md.h from <JDK_HOME>/Contents/Home/include/darwin to <JDK_HOME>/Contents/Home/include and run npm install java
Reacted by yaojie, Jascha Ephraim and Javier García Valdepeñas
Activity
inolen commentedon Nov 12, 2013
Seems like perhaps JAVA_HOME may not being discovered properly. I'd try manually setting that, and if that still doesn't work, mucking with binging.gyp line ~130 until you can resolve the issue.
kevinrc commentedon Nov 12, 2013
I was having the same issue as Jamund and I've managed to work around it. The solution seems to be setting the JAVA_HOME env variable. I also updated to 1.7.0_45 but I'm not sure that had any effect on finding the solution.
apowers313 commentedon Nov 12, 2013
I'm on Mavericks with the same version of Java and haven't seen this issue and can't reproduce it by unsetting or changing JAVA_HOME.
xjamundx commentedon Nov 13, 2013
In case anyone else has the problem. I did the following.
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_45.jdk/Contents/Home/npm install javaSee: http://stackoverflow.com/questions/9704376/how-to-install-java-native-development-headers-on-os-x-lion for a reference
kevinrc commentedon Nov 14, 2013
In talking with a few other folks who have Mavericks and did not have this issue, it appears that if you had 1.7.0_45 before upgrading to Mavericks the issue doesn't appear. After Mavericks the JDK installer no longer appears to update the current_jdk link. So, the only way to solve the issue is to set JAVA_HOME or update the link to point to the latest JDK.
Added link to issue #86 for Mavericks users
loretoparisi commentedon Dec 6, 2016
@kevinrc I'm having this error on
macOS Sierraand idk 1.8, did you experienced it on recent models of MPB and java8?nselikoff commentedon Jul 26, 2017
I was experiencing a similar issue, although the file that couldn't be found was
jni_md.h. Turns out, if you're usingjenv(https://github.com/gcuisinier/jenv), because it uses a shim and symlink forJAVA_HOME,node-javawill resolve the path to "Users" not "Library" and therefore won't include the extradarwinsubdirectory (wherejni_md.his located).nicholasren commentedon Sep 19, 2017
I'm using
jenvand run into the exactly same problem @nselikoff mentioned above.My current workaround is copy
jni_md.handjawt_md.hfrom<JDK_HOME>/Contents/Home/include/darwinto<JDK_HOME>/Contents/Home/includeand runnpm install javaparminder7 commentedon Jun 13, 2018
@nicholasren I am also using
jenvand tried your recommended solution, but I am still gettingerror. What do you suggest to do next?
paulwcy commentedon Jun 19, 2018
I'm using
jenvas well...Setting JAVA_HOME worked for me
export JDK_HOME=$(/usr/libexec/java_home -v 1.8)mustafabutt-dev commentedon Jan 8, 2024
I am also facing this issue with the following specs:
node --version
v21.1.0
java version "1.8.0_381"
Java(TM) SE Runtime Environment (build 1.8.0_381-b09)
Java HotSpot(TM) 64-Bit Server VM (build 25.381-b09, mixed mode)