Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

'require() of ES not supported Module' in 2.1.0 #20

Open
Thegaram opened this issue Nov 4, 2021 · 2 comments
Open

'require() of ES not supported Module' in 2.1.0 #20

Thegaram opened this issue Nov 4, 2021 · 2 comments

Comments

@Thegaram
Copy link

Thegaram commented Nov 4, 2021

I have @web-std/fetch as a sub-dependency. Starting yesterday I started having this issue during build. Downgrading to @web-std/[email protected] resolves this.

[path]/node_modules/ts-node/dist/index.js:729
            return old(m, filename);
                   ^
Error [ERR_REQUIRE_ESM]: require() of ES Module [path]/node_modules/@ssttevee/multipart-parser/lib/index.js from [path]/node_modules/@web-std/fetch/dist/index.cjs not supported.
Instead change the require of index.js in [path]/node_modules/@web-std/fetch/dist/index.cjs to a dynamic import() which is available in all CommonJS modules.
    at Object.require.extensions.<computed> [as .js] ([path]/node_modules/ts-node/dist/index.js:729:20)
    at Object.<anonymous> ([path]/node_modules/@web-std/fetch/dist/index.cjs:14:25)
    at Object.require.extensions.<computed> [as .js] ([path]/node_modules/ts-node/dist/index.js:729:20)
    at Object.<anonymous> ([path]/node_modules/nft.storage/dist/src/token.cjs:5:1)
    at Object.require.extensions.<computed> [as .js] ([path]/node_modules/ts-node/dist/index.js:729:20)
    at Object.<anonymous> ([path]/node_modules/nft.storage/dist/src/lib.cjs:8:13)
    at Object.require.extensions.<computed> [as .js] ([path]/node_modules/ts-node/dist/index.js:729:20)
    at Object.<anonymous> ([path]/src/services/ipfs.ts:28:23)
    at Module.m._compile ([path]/node_modules/ts-node/dist/index.js:735:29)
    at Object.require.extensions.<computed> [as .ts] ([path]/node_modules/ts-node/dist/index.js:737:16)
...
@joeangel
Copy link

joeangel commented Nov 4, 2021

same issue here

in node v16

$ node --version
v16.12.0
$ npm --version
8.1.0

in node 14

$ node --version
v14.17.6
$ npm --version
6.14.15

@Gozala
Copy link
Contributor

Gozala commented Jan 19, 2022

I am sorry but I don't have enough cycles to do investigations. If you would like to get this resolved I would suggest:

  1. Create a reproducible test case so that it fail in CI https://github.com/web-std/io/blob/main/.github/workflows/fetch.yml in which would make it easier for anyone to fix this.
  2. Better yet provide a pull request with failing test + fix so it can be addressed quickly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants