nodejvm
nodejvm copied to clipboard
It doesn't work
ekolotyluk@Erics-MBP nodejvm % ./gradlew dat-sample:run
> Task :dat-sample:run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dat-sample:run'.
> Process 'command '/Users/ekolotyluk/dev/nodejvm/build/nodejvm/nodejvm'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 939ms
9 actionable tasks: 1 executed, 8 up-to-date
I tried it with the latest GraalVM and it does work. However, you can get this unhelpful error from Gradle (it just means nodejvm returned an error) in these circumstances:
- The node binary on your $PATH is not GraalVM node.
- And there's no $GRAALVM_PATH environment variable set pointing to it.
- Or that variable is set but to the wrong path - it has to point to the
bindirectory of your GraalVM install. - Or you are on macOS and haven't removed the quarantine attribute from your install, thus cannot start Node at all.
Try running build/nodejvm/nodejvm -version to see if you get an error and if so, try to fix it.
Thanks for responding...
- I don't know what you mean?
- My GRAALVM_PATH=/Library/Java/JavaVirtualMachines/graalvm-ce-java11-21.0.0.2/Contents/Home/bin
- It is the
bindirectory - I am on macOS and I don't know what you mean
Furthermore, when I run build/nodejvm/nodejvm -version I get
openjdk version "11.0.10" 2021-01-19
OpenJDK Runtime Environment GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06)
OpenJDK 64-Bit Server VM GraalVM CE 21.0.0.2 (build 11.0.10+8-jvmci-21.0-b06, mixed mode, sharing)
I was trying to follow Running the Samples but the entire piece before Running the Samples about node makes no sense to me at all. It is possible you could explain it in such a way that someone who has no prior experience with Node.js could understand it?
When I follow Polyglot JavaScript, Java, R Example Application it just works, I had no trouble following it. They explained it in such a way that everything was clear, and it just works.
The new state is now
ekolotyluk@Erics-MBP nodejvm % gradle dat-sample:run
> Task :dat-sample:run
Error: Cannot find module 'dat-node'
Require stack:
- /Users/ekolotyluk/dev/nodejvm/dat-sample/[eval]
at <js> Module._resolveFilename(internal/modules/cjs/loader.js:815:25199-25216)
at <js> Module._load(internal/modules/cjs/loader.js:667:20560-20607)
at <js> Module.require(internal/modules/cjs/loader.js:887:27547-27588)
at <js> require(internal/modules/cjs/helpers.js:74:2284-2300)
at <js> :program(eval at <anonymous> (eval at <anonymous> ([eval]:1:1)):2:23-41)
at <js> :anonymous(Unknown)
at org.graalvm.sdk/org.graalvm.polyglot.Value.execute(Value.java:457)
at net.plan99.nodejs.java.NodeJS.eval(NodeJS.java:196)
at net.plan99.nodejs.kotlin.NodeJSAPI.run(NodeJS.kt:65)
at net.plan99.nodejs.sample.DatExplorer$main$1.invoke(DatExplorer.kt:29)
at net.plan99.nodejs.sample.DatExplorer$main$1.invoke(DatExplorer.kt)
at net.plan99.nodejs.kotlin.NodeJSKt$nodejs$1.get(NodeJS.kt:22)
at java.base/java.util.concurrent.CompletableFuture$AsyncSupply.run(CompletableFuture.java:1700)
at <js> :=>(eval at <anonymous> ([eval]:1:1):27:1052-1061)
at <js> emit(events.js:314:9086-9118)
at <js> :=>(internal/worker.js:198:6079-6103)
at <js> emit(events.js:314:9086-9118)
at <js> onmessage(internal/worker/io.js:80:2876-2907)
> Task :dat-sample:run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dat-sample:run'.
> Process 'command '/Users/ekolotyluk/dev/nodejvm/build/nodejvm/nodejvm'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7.1/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 14s
9 actionable tasks: 9 executed
Can you try running npm install in the dat_sample directory?
Okay, the first time failed with
ekolotyluk@Erics-MBP dat-sample % npm install
npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated
. . .
1 warning and 4 errors generated.
make: *** [Release/obj.target/utp/src/socket_wrap.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (node:events:376:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:284:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/usr/local/Cellar/node/15.5.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/ekolotyluk/dev/nodejvm/dat-sample/node_modules/utp-native
gyp ERR! node -v v15.5.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/sodium-native):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp-build "node preinstall.js" "node postinstall.js"`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/utp-native):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp-build`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1
. . .
and
╭───────────────────────────────────────────────────────────────╮
│ │
│ New major version of npm available! 6.14.11 → 7.6.1 │
│ Changelog: https://github.com/npm/cli/releases/tag/v7.6.1 │
│ Run npm install -g npm to update! │
│ │
╰───────────────────────────────────────────────────────────────╯
so I did that
ekolotyluk@Erics-MBP ~ % npm install -g npm
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
+ [email protected]
added 59 packages from 24 contributors, removed 241 packages and updated 194 packages in 5.734s
then
ekolotyluk@Erics-MBP ~ % cd dev
ekolotyluk@Erics-MBP dev % cd nodejvm
ekolotyluk@Erics-MBP nodejvm % cd dat-sample
ekolotyluk@Erics-MBP dat-sample % npm install
added 1 package, and audited 261 packages in 7s
found 0 vulnerabilities
then went back to
ekolotyluk@Erics-MBP dat-sample % cd ..
ekolotyluk@Erics-MBP nodejvm % ./gradlew dat-sample:run
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :dat-sample:run FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':dat-sample:run'.
> Process 'command '/Users/ekolotyluk/dev/nodejvm/build/nodejvm/nodejvm'' finished with non-zero exit value 1
* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights.
* Get more help at https://help.gradle.org
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.7/userguide/command_line_interface.html#sec:command_line_warnings
BUILD FAILED in 12s
9 actionable tasks: 9 executed
Does that help?
Hmm. The way Gradle hides error messages is really getting in the way here, that's frustrating. Can you try running gradle dat-sample:run --info and pasting the output and any errors you see in the final section here? The --info flag should ensure it prints out everything, including the command it's running so you can copy/paste it and try running it outside of Gradle itself.
It's been two years, time to close ...