Is the sample provided for Node in the rhino3dm.js working?

I get this after rhino3dm = require('rhino3dm')()

TypeError: fetch failed
    at Object.processResponse (node:internal/deps/undici/undici:6323:34)
    at node:internal/deps/undici/undici:6648:42 {
  cause: Error: unknown scheme
      at makeNetworkError (node:internal/deps/undici/undici:5296:35)
      at schemeFetch (node:internal/deps/undici/undici:6624:18)
      at node:internal/deps/undici/undici:6480:26
      at mainFetch (node:internal/deps/undici/undici:6497:11)
      at fetching (node:internal/deps/undici/undici:6454:7)
      at Agent.fetch2 (node:internal/deps/undici/undici:6334:20)
      at Object.fetch (node:internal/deps/undici/undici:7125:20)
      at fetch (node:internal/process/pre_execution:214:25)
      at instantiateAsync (C:\Users\RSF\Documents\DEV\NODE\RHINO\TEST_01\node_modules\rhino3dm\rhino3dm.js:9:16039)
      at createWasm (C:\Users\RSF\Documents\DEV\NODE\RHINO\TEST_01\node_modules\rhino3dm\rhino3dm.js:9:16646) {
    [cause]: undefined

Node.js v18.8.0

Which sample? I just tried both samples, and they seem to work fine.

i have the same issue, i cannot run rhino3dm from nodejs, from index.jr or directly from terminal.
it was working for me before, like year ago.

I got this resolved with help of McNeel, last working nodejs version is 18.0.0

1 Like

Depending on the version of emscriptem, web assembly compiled code is not compatible with Node v18.1.0 and above. See: emscripten-core/emscripten#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. emscripten-core/emscripten#16917

In the meantime you can run your scripts with rhino3dm.js 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.