question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failed to run ifcApi.Init() in nodejs

See original GitHub issue

I followed the example in /examples/nodejs/index.js

const WebIFC = require("./node_modules/web-ifc/web-ifc-api-node.js");

console.log("Hello web-ifc-node!");

const ifcapi = new WebIFC.IfcAPI();

export async function LoadFile(filename) {
  // load model data as a string
  const ifcData = fs.readFileSync(filename);

  await ifcapi.Init();

...

I’m getting error below. It’s caused by the ifcApi.Init() function. Tried with different nodejs-versions (v18 & 19). Same result. Any suggestions?

TypeError: Failed to parse URL from /../node_modules/web-ifc/web-ifc.wasm
[ERROR] 15:46:49 RuntimeError: abort(TypeError: Failed to parse URL from /../node_modules/web-ifc/web-ifc.wasm). Build with -s ASSERTIONS=1 for more info.
/../node_modules/web-ifc/web-ifc-api-node.js:6689
              throw ex;
              ^

RuntimeError: abort(TypeError: Failed to parse URL from /../node_modules/web-ifc/web-ifc.wasm). Build with -s ASSERTIONS=1 for more info.
    at process.abort (/../node_modules/web-ifc/web-ifc-api-node.js:7104:19)
    at process.emit (node:events:513:28)
    at process.emit (/../node_modules/source-map-support/source-map-support.js:516:21)
    at emit (node:internal/process/promises:150:20)
    at processPromiseRejections (node:internal/process/promises:284:27)
    at processTicksAndRejections (node:internal/process/task_queues:96:32)

Issue Analytics

  • State:open
  • Created 10 months ago
  • Reactions:2
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iainsproatcommented, Dec 6, 2022

Hi, can this issue please be re-opened? I’d like to see Node 18 supported as it’s the only version in active LTS. While there is a workaround, that does mean disabling fetch which may be required by other dependencies.

1reaction
sjovanoviccommented, Nov 22, 2022

Turns out that this error is because of the experimental fetch implementation in newer node versions.

The error is handled in newer versions of Emscripten so authors of web-ifc should update and recompile the web assembly to fix this. Here’s the reference issue: https://github.com/emscripten-core/emscripten/issues/16913

Meanwhile, you can still run on newer node if you supply --no-experimental-fetch option:

$ node --no-experimental-fetch index.js 
Read more comments on GitHub >

github_iconTop Results From Across the Web

Node.js implemented `WebAssembly.instantiateStreaming` in ...
preamble.js: Don't use fetch() in Node.js environment ... Failed to run ifcApi.Init() in nodejs IFCjs/web-ifc#268.
Read more >
Why am I getting "Cannot access 'server' before initialization ...
I routinely keep launch.json pretty sparse, and the same error happens using node server in Terminal. Here is the offending code. The issue ......
Read more >
Errors | Node.js v19.3.0 Documentation
The Error.stackTraceLimit property specifies the number of stack frames collected by a stack trace (whether generated by new Error().stack or Error.
Read more >
Initializing a Node Project - Thinkster.io
Learn how to get an Express.js application running in development using ... If the install command fails complaining about permissions, you may need...
Read more >
node-fetch - npm
Instead of implementing XMLHttpRequest in Node.js to run ... To use fetch() without importing it, you can patch the global object in node:....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found