node-java icon indicating copy to clipboard operation
node-java copied to clipboard

Cannot find module '/build/Release/nodejavabridge_bindings.node'

Open Slaventsiy opened this issue 9 years ago • 4 comments

The module seems to be installed properly and running npm test shows everything is ok. When I build, webpack gives only one warning:

Critical dependencies:
21:15-34 the request of a dependency is an expression
@ ./~/java/lib/nodeJavaBridge.js 21:15-34

However, the script doesn't run and gives:

Uncaught Error: Cannot find module '/build/Release/nodejavabridge_bindings.node'

Slaventsiy avatar Apr 22 '16 10:04 Slaventsiy

You may want to look at this http://stackoverflow.com/questions/32832179/using-webpack-with-nodejs-native-modules and more specifically this http://jlongster.com/Backend-Apps-with-Webpack--Part-I to exclude native modules from webpack.

Try something like...

externals: {
  'node_modules/java/build/Release/nodejavabridge_bindings.node': 'java'
}

joeferner avatar May 01 '16 20:05 joeferner

Has anyone had luck solving this?

coco-napky avatar May 07 '17 19:05 coco-napky

change var bindings = require(binaryPath); to var bindings = __non_webpack_require__(binaryPath);

And you need to copy jvm.dll & classes.jsa to current directory.

flyfishzy avatar May 04 '18 02:05 flyfishzy

@coco-napky Do you found any solution on how to make it work? i am quessing @joeferner will never respond :P

PanagiotisDrakatos avatar Mar 24 '23 19:03 PanagiotisDrakatos