rhino3dm: rhino3dm.js incompatible with Node v18. I keep getting error ERR_INVALID_URL
I was getting this issue with 0.14.0. After upgrading to 7.15.0 I keep getting the same error.
TypeError: Failed to parse URL from {project path}/node_modules/rhino3dm/rhino3dm.wasm
at Object.fetch (node:internal/deps/undici/undici:11118:11)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
[cause]: TypeError [ERR_INVALID_URL]: Invalid URL
at new NodeError (node:internal/errors:393:5)
at URL.onParseError (node:internal/url:565:9)
at new URL (node:internal/url:645:5)
at new Request (node:internal/deps/undici/undici:9472:25)
at Agent.fetch2 (node:internal/deps/undici/undici:10291:25)
at Object.fetch (node:internal/deps/undici/undici:11116:28)
at fetch (node:internal/process/pre_execution:216:25)
at instantiateAsync ({project path}/node_modules/rhino3dm/rhino3dm.js:9:16039)
at createWasm ({project path}/node_modules/rhino3dm/rhino3dm.js:9:16646)
at {project path}/node_modules/rhino3dm/rhino3dm.js:9:131229 {
input: '{project path}/node_modules/rhino3dm/rhino3dm.wasm',
code: 'ERR_INVALID_URL'
}
}
I’m not sure what’s going on, because the file at {project path}/node_modules/rhino3dm/rhino3dm.wasm is there. I can do cat {project path}/node_modules/rhino3dm/rhino3dm.wasm
and see a bunch of binary output.
I think I might have updated node to v18.12.1 before I started seeing this issue. Could this be a node 18 compatibility issue?
I do get this warning when starting the server:
(node:71881) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
About this issue
- Original URL
- State: closed
- Created a year ago
- Comments: 15 (7 by maintainers)
answered in #521
Thanks for the heads up! I just upgraded to 8.0.0 and it’s working great using node v18
@dgrcode Just published rhino3dm.js 8.0.0. https://www.npmjs.com/package/rhino3dm
Thanks for testing! We have most everything in place for a release except for testing. Hopefully we can wrap it up in a week or so.
I can confirm the files in the link work as expected. Thanks for fixing this one. Is there an estimate update release date?
update: by updating our build tools, this issue is no longer present. We are getting ready to release an update. If you want to test, you can do so my using a recent build of js: https://github.com/mcneel/rhino3dm/suites/11184627947/artifacts/571581718
Awesome, thanks for the details and workaround 🙌
@dgrcode Depending on the version of emscriptem, web assembly compiled code is not compatible with Node v18.1.0 and above. See: https://github.com/emscripten-core/emscripten/issues/16913
Seems there was a patch applied. We need to see how to build rhino3dm with an updated version of emscripten to get the benefit of the patch. https://github.com/emscripten-core/emscripten/pull/16917
In the meantime you can run your scripts in node.js 18.1.0 and above like so:
node --no-experimental-fetch index.js
Running in 16.15.0 (at least, haven’t checked below) - 18.0.0 works as you’d expect.