Open Rinse12 opened 2 years ago
I fixed the issue by explicitly install node-fetch@2 instead of version 3 where it's required to use ES module.
"dependencies": {
"node-fetch": "^2.6.7",
"ipfs-core": "^0.13.0",
"ipfs-http-client": "^55.0.0"
},
node-fetch
is a peer dependency of native-fetch
- this module has a dependency on node-fetch@2.x.x
which is CJS so you should not need to install it yourself.
If you are seeing ERR_REQUIRE_ESM
it means a copy of node-fetch@3
is in your dependency tree somewhere.
When you don't install the dep yourself, what do you see when you run:
$ npm ls node-fetch
would a PR with ESM rewrite be welcome? ipfs-http-client
is already ESM so I don't think this should be a problem to use ipfs-utils
with modern Node.js
Hello team,
I'm receiving an error whenever I try to import
ipfs-http-client
. I realize this isjs-ipfs-utils
repo but the error is orignating from this repo's code.My code
Error when I run
mocha test
The line in
ipfs-utils/src/fetch.js(9)
using require and causing the problemMy package.json