You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
snarkjs cannot be used with ES modules as some iden3 packages depend on web-worker@1.3.0, which for some reason doesn't include type: "module" in its package.json (and exports its ES modules with .js instead of .mjs). Related issue: developit/web-worker#44.
Here are the dependencies that cause this problem:
web-worker@1.2.0 works fine but ^ makes package managers (Yarn for sure) to download the latest minor, i.e. v1.3.0.
ffjavascript@0.2.63 seems to fix it by using a fixed version (precisely v1.2.0) and r1csfile and circom_runtime on Github seem to depend on ffjavascript@0.2.63, but their latest version was actually released with ffjavascript@0.2.60, as you can check on NPM:
I guess 1 solution here is just to release a new version of r1csfile and circom_runtime first, and then a new version of snarkjs with those dependencies updated.
(node:30967) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/cedoor/Downloads/tests/snarkjs/node_modules/circom_runtime/node_modules/web-worker/node.js:17
import URL from 'url';
^^^^^^
SyntaxError: Cannot use import statement outside a module
at internalCompileFunction (node:internal/vm:77:18)
at wrapSafe (node:internal/modules/cjs/loader:1288:20)
at Module._compile (node:internal/modules/cjs/loader:1340:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
at Module.load (node:internal/modules/cjs/loader:1207:32)
at Module._load (node:internal/modules/cjs/loader:1023:12)
at cjsLoader (node:internal/modules/esm/translators:345:17)
at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:294:7)
at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
Node.js v20.10.0
Other information:
Using Yarn v4.1.0 and NodeJS v20.10.0.
The text was updated successfully, but these errors were encountered:
Description
snarkjs
cannot be used with ES modules as some iden3 packages depend onweb-worker@1.3.0
, which for some reason doesn't includetype: "module"
in itspackage.json
(and exports its ES modules with.js
instead of.mjs
). Related issue: developit/web-worker#44.Here are the dependencies that cause this problem:
r1csfile@0.0.47
->ffjavascript@0.2.60
->web-worker@^1.2.0
circom_runtime@0.1.24
->ffjavascript@0.2.60
->web-worker@^1.2.0
web-worker@1.2.0
works fine but^
makes package managers (Yarn for sure) to download the latest minor, i.e.v1.3.0
.ffjavascript@0.2.63
seems to fix it by using a fixed version (preciselyv1.2.0
) andr1csfile
andcircom_runtime
on Github seem to depend onffjavascript@0.2.63
, but their latest version was actually released withffjavascript@0.2.60
, as you can check on NPM:I guess 1 solution here is just to release a new version of
r1csfile
andcircom_runtime
first, and then a new version ofsnarkjs
with those dependencies updated.Example
index.js
:package.json
:Error
Other information:
Using Yarn v4.1.0 and NodeJS v20.10.0.
The text was updated successfully, but these errors were encountered: