fictionco / fiction

(Join Waiting List) Personal Marketing Platform. A powerful platform for your online identity.
https://www.fiction.com
1.42k stars 109 forks source link

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

Closed acalvino4 closed 3 years ago

acalvino4 commented 3 years ago

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 commented 3 years ago

Duplicate issue, look up issue #257

acalvino4 commented 3 years ago

thanks!