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

throw new ERR_REQUIRE_ESM(filename, parentPath, packageJsonPath); #18

Closed
NayeemUrRehman opened this issue Apr 16, 2021 · 5 comments
Closed

Comments

@NayeemUrRehman
Copy link

Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /Users/nayeem/Projects/NodeJs/svc-node-app/node_modules/into-stream/index.js
require() of ES modules is not supported.
require() of /Users/nayeem/Projects/NodeJs/svc-node-app/node_modules/into-stream/index.js from /Users/nayeem/Projects/NodeJs/svc-node-app/dist/main.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/nayeem/Projects/NodeJs/svc-node-app/node_modules/into-stream/package.json.

@sindresorhus
Copy link
Owner

Please read the release notes.

@jacobq
Copy link

jacobq commented Aug 5, 2021

Please consider adding a link to the release notes in the readme. When there isn't a changelog file present I often find myself wasting a few minutes to locate the notes since there is no universal location to put these things (some put it in commit notes, some under releases, some under a separate file in the repo, ...)
In this case, I ended up searching the issues for 'ESM' because I suspected that changed after I ran into some problems attempting a blind upgrade.
FWIW, the v7.0.0 notes are here --> https://github.com/sindresorhus/into-stream/releases/tag/v7.0.0

@sindresorhus
Copy link
Owner

no universal location to put these things

https://github.com/sindresorhus/into-stream/releases is the canonical place. This is where you should always look first. I don't intend to put a link in the readme.

@elimisteve
Copy link

I actually get this same ERR_REQUIRE_ESM error no matter how I import into-stream. Anyone else have this problem?

@elimisteve
Copy link

Solution: I just reverted back to into-stream@6.0.0 because adding "type": "module" to my package.json was giving me problems.

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

4 participants