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

"Error [ERR_REQUIRE_ESM]: Must use import to load ES Module:" at yarn factor dev #260

Closed
acalvino4 opened this issue Feb 9, 2021 · 2 comments

Comments

@acalvino4
Copy link

acalvino4 commented Feb 9, 2021

Reason for this issue
Getting started with a factor app is theoretically super easy: just npx create-factor-app <app-name>, then npx factor dev. However, I get the following error:

» npx factor dev
Must use import to load ES Module: /Users/acalvino4/Code/Learning/factor2/node_modules/lodash-es/lodash.js
require() of ES modules is not supported.
require() of /Users/acalvino4/Code/Learning/factor2/node_modules/lodash-es/lodash.js from /Users/acalvino4/Code/Learning/factor2/node_modules/@factor/api/utils-lodash.ts 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 lodash.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /Users/acalvino4/Code/Learning/factor2/node_modules/lodash-es/package.json.

Steps to Reproduce

npx create-factor-app factor
cd factor
npx factor dev

See resulting error

Note: I tried this process with the yarn equivalents, and got the same error

MacOS 11.2
npm 6.14.11
node 14.8.0
yarn 1.22.10

UPDATE: the manual instructions result in the same error.

@bppdddqqqq
Copy link

Duplicate issue, look up issue #257

@acalvino4
Copy link
Author

thanks!

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

2 participants