Failed to run ifcApi.Init() in nodejs
See original GitHub issueI 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:
- Created 10 months ago
- Reactions:2
- Comments:8 (2 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
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: