ton-contract-executor icon indicating copy to clipboard operation
ton-contract-executor copied to clipboard

Error on Node.js 18

Open NoelJacob opened this issue 2 years ago • 4 comments

(node:15366) ExperimentalWarning: The Fetch API is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)

node:internal/event_target:908
  process.nextTick(() => { throw err; });
                           ^
TypeError [Error]: Failed to parse URL from /home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vm-exec.wasm
    at new Request (node:internal/deps/undici/undici:4813:19)
    at Agent.fetch2 (node:internal/deps/undici/undici:5539:29)
    ... 4 lines matching cause stack trace ...
    at /home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vm-exec.js:9:38689
    at getInstance (/home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vmExec.js:16:22)
    at vm_exec (/home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vmExec.js:22:28)
    at runTVM (/home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/executor/executor.js:58:39)
Emitted 'error' event on Worker instance at:
    at [kOnErrorMessage] (node:internal/worker:289:10)
    at [kOnMessage] (node:internal/worker:300:37)
    at MessagePort.<anonymous> (node:internal/worker:201:57)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:639:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28) {
  [cause]: TypeError [ERR_INVALID_URL]: Invalid URL
      at new NodeError (node:internal/errors:377:5)
      at URL.onParseError (node:internal/url:563:9)
      at new URL (node:internal/url:643:5)
      at new Request (node:internal/deps/undici/undici:4811:25)
      at Agent.fetch2 (node:internal/deps/undici/undici:5539:29)
      at Object.fetch (node:internal/deps/undici/undici:6370:20)
      at fetch (node:internal/bootstrap/pre_execution:196:25)
      at instantiateAsync (/home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vm-exec.js:9:10542)
      at createWasm (/home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vm-exec.js:9:11152)
      at /home/noel/Desktop/conex/node_modules/.pnpm/[email protected][email protected]/node_modules/ton-contract-executor/dist/vm-exec/vm-exec.js:9:38689
}

Node.js v18.2.0

I ran the examples and this is the result. My system is arch linux.

NoelJacob avatar May 19 '22 05:05 NoelJacob

This is an bug https://github.com/emscripten-core/emscripten/issues/16913, caused by Node adding WebAssembly.instantiateStreaming in version 18. I'm sure either emscripten or node will come up with a real solution to this at some point (there's a PR https://github.com/emscripten-core/emscripten/pull/16917), but in the mean time you can work around this by invoking node with --no-experimental-fetch.

NoelJacob avatar May 23 '22 10:05 NoelJacob

I have encountered exact same issue on Node v18.7.0. Downdrading to v16.18.0 solves the issue.

arterialist avatar Oct 24 '22 14:10 arterialist

It is very frustrating, at least it would be great if some error message will be added for users who want to compile it on node 18. Is it possible to fix somehow?

manylov avatar Apr 28 '23 16:04 manylov

@manylov @arterialist do node --no-experimental-fetch script.js

NoelJacob avatar Jul 08 '23 07:07 NoelJacob