node-java error: libjvm.so: cannot open shared object file: No such file or directory

懵懂的女人 提交于 2019-12-08 03:56:17

问题


I am getting an error in the following node-plugin and opened an issue: plugin is here: https://github.com/joeferner/node-java issue is here: https://github.com/joeferner/node-java/issues/306

I see a similar problem that was solved on SO regarding developers who use rStudio: libjvm.so: cannot open shared object file: No such file or directory

I am having a similar error when I launch my node app to heroku:

return process.dlopen(module, path._makeLong(filename));
                 ^

Error: libjvm.so: cannot open shared object file: No such file or directory
    at Error (native)
    at Object.Module._extensions..node (module.js:440:18)
    at Module.load (module.js:357:32)
    at Function.Module._load (module.js:314:12)
    at Module.require (module.js:367:17)
    at require (internal/module.js:16:19)
    at Object.<anonymous> (/app/node_modules/java/lib/nodeJavaBridge.js:31:16)
    at Module._compile (module.js:413:34)
    at Object.Module._extensions..js (module.js:422:10)
    at Module.load (module.js:357:32)

回答1:


It looks like you'll need to set the JAVA_HOME environment variable like this:

$ heroku config:set JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"

This is because you are using the stack JDK (the default JDK). You can also use a custom JDK (usually a newer version) by adding the jvm-common buildpack to your app, which will also set JAVA_HOME for you:

$ heroku buildpacks:clear
$ heroku buildpacks:add https://github.com/heroku/heroku-buildpack-jvm-common
$ heroku buildpacks:add heroku/nodejs

Then redeploy with git push.



来源:https://stackoverflow.com/questions/36191073/node-java-error-libjvm-so-cannot-open-shared-object-file-no-such-file-or-dire

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!