简体   繁体   中英

Module not found error for nodejavabridge_bindings.node when executing jest test although file exists on specified directory

I am using NCache NodeJS client package and writing tests by calling NCache API's. Package has dependency of Java. After I installed and used that package to write simple test. Test execution failed with module not Found error: Error Message Messgae: The specified module could not be found. \\D:\GitHome\Test\node_modules\java\build\Release\nodejavabridge_bindings.node

  at Runtime._loadModule (node_modules/jest-runtime/build/index.js:893:29)
  at Object.<anonymous> (node_modules/java/lib/nodeJavaBridge.js:21:16)

File in above mentioned directory exits.

Note : When I used that package in simple index.js file it worked fine as expected but unable to run with jest.

No major configuration done for jest in package.json file. Java jdk-11.0.6 installed on box and JAVA_HOME is set.

Package.json

test.specs.js

Unable to identify the exact reason of failure therefore stuck on how to resolve it. Environment: OS: Windows node: 14.15.3 jest: 26.6.3

C:\Program Files\OpenJDK\jdk-16.0.1\bin\server needs to be in your path. On windows can Edit the system environment > Environment Variables... > System variables and add C:\Program Files\OpenJDK\jdk-16.0.1\bin\server

Other option is to add it to your test runner. For example in WebStorm edit the Run Configurations and add Environment variables PATH=C:\Program Files\OpenJDK\jdk-16.0.1\bin\server

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM