fictionco / fiction

(Public Release Summer 2024) Personal Marketing Platform. A powerful platform for your online identity.

Home Page:https://www.fiction.com

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

acalvino4 opened this issue · comments

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.

Duplicate issue, look up issue #257