Open
Description
Hi, I am trying to load n NPM module on a Stock JDK (openjdk_17.0.1_17.30.16_x64) with graal dependencies, following this documentation
val graalVersion = "22.0.0.2"
implementation("org.graalvm.sdk:graal-sdk:$graalVersion")
implementation("org.graalvm.js:js:$graalVersion")
fun main() {
val options: MutableMap<String, String> = HashMap()
options["js.commonjs-require"] = "true"
options["js.commonjs-require-cwd"] = "graal-js"
//options["js.commonjs-global-properties"] = "./globals.js"
options["js.commonjs-core-modules-replacements"] =
"buffer:buffer/, path:path-browserify, crypto:crypto-js, uuid:uuid-browser"
val cx: Context = Context.newBuilder("js")
.allowExperimentalOptions(true)
.allowIO(true)
.options(options)
.build()
cx.eval("js", "const newman = require('newman');")
}
Github link for a runnable program
I get this exception (Complete log attached), I could infer this is due to the uuid-browser module. This is the javascript line where I get this exception.
if ((i & 0x03) === 0) r = Math.random() * 0x100000000;
what am I missing or is this a bug in graaljs?
Exception in thread "main" org.graalvm.polyglot.PolyglotException: java.lang.NullPointerException: Cannot invoke "java.util.SplittableRandom.nextDouble
[log.log](https://github.com/oracle/graaljs/files/8458779/log.log)
()" because the return value of "com.oracle.truffle.js.runtime.JSRealm.getRandom()" is null
at com.oracle.truffle.js.builtins.math.RandomNode.random(RandomNode.java:56)
at com.oracle.truffle.js.builtins.math.RandomNodeGen.execute(RandomNodeGen.java:28)
at com.oracle.truffle.js.nodes.function.FunctionRootNode.executeInRealm(FunctionRootNode.java:143)
at com.oracle.truffle.js.runtime.JavaScriptRealmBoundaryRootNode.execute(JavaScriptRealmBoundaryRootNode.java:92)