wasm failed
cyanyiyi opened this issue · comments
On running server in my Vue2 application using yarn serve locally :
Uncaught RuntimeError: abort(sync fetching of the wasm failed: you can preload it to Module['wasmBinary'] manually, or emcc.py will do that for you when generating HTML (but not JS)). Build with -s ASSERTIONS=1 for more info.
I also faced with this problem. This happened because this package don't adapted to run in browser. I solved this problem when i had assemble this using browserify. There may be required to add change a third number in index.js to
const m = await Module({ wasmBinary: bin })
and delete Module["then"]
So this helped to me to run this package, but I also encountered some problems with working with this package.
Thanks to some guys in tg chat that help me with this.
The loading problem comes from the script Module(bin.data)
which should be just Module(bin)
as mentioned above.
After that, you will need to run the script within a Webworker thread as the code is too large to instantiate.
This repo points to an example in statsim which is written by the same author showing how to use his Port
package to run the script.
Inside the worker.js, you can just require('arima')
and use it no problem.
In case if you are using webpack 5, see this example.
If you have problem parsing import.meta
, this plugin may help.
However if you are using earlier version(i.e. webpack 4), you can use worker-loader as suggested by the guide above.
Hope this helps anyone who see to do some ARIMA :) with this brilliant library.
Hey, sorry for reacting late. @CKPOON0619, you are right, there's an error in the index.js
and Module
should load bin
, not bin.data
. I used to bundle a wasm file in native.bin.js
as module.exports = {"type":"Buffer","data":[0,97...
, but then switched to more compact representation module.exports = toUint8Array('AGFz...
. The tricky part is, when loading index.js
from Node, wasmBinary
parameter is undefined
, as in the browser, but Node doesn't throw the error, because it falls back to the original wasm
file. So tests passed and I missed this error.
01aef47: changed bin.data
to bin
and added a browser example
Hah, It seems that GitHub automatically closes issues based on a commit text. I'm reopening it as:
a Webworker thread as the code is too large to instantiate. (moved to #10)
webpack
Added async
mode: #10 (comment) (works in Chrome)