Closed recidive closed 1 year ago
For sure! In a new folder, create a simple package.json file containing
{ "dependencies": { "eigen": "^0.2.2" } }
Create a file named test.mjs containing
` // test.mjs import eig from 'eigen';
(async () => { await eig.ready; let M = new eig.Matrix([[1, 2], [3, 4]]); M.print("M"); M = M.inverse(); M.print("Minv"); eig.GC.flush(); })(); `
Now run yarn
in that folder to install dependencies, and execute the test using node test.mjs
Yes, this worked now, but sometimes it breaks with the error TypeError: eigen_1.default.Matrix is not a constructor
. I got this intermittently in an Observable notebook.
Maybe this is something related to asynchronous loading of the wasm?
Ah, I never tried it in that context. Not sure how Observable handles package loading...
I'm not saying this is just on Observable but in both contexts, this is an intermittent error that needs some debugging, maybe using async import()
in typescript helps.
I'm trying to run
eigen-js
in Node.js and I'm getting this error when instantiating a new Matrix:TypeError: eigen_1.default.Matrix is not a constructor
Is this supposed to work on Node.js?