After running the "email dev" command, an error occurs
Describe the Bug
After running the "email dev" command, an error occurs.
Which package is affected (leave empty if unsure)
No response
Link to the code that reproduces this issue
To Reproduce
Computer info: Actual OS: win32 Actual Arch: x64
Steps to reproduce:
1. Type "yarn dev" after installation
yarn run v1.22.19
$ email dev
D:\.dev\reactjs\safetalk-emails\node_modules\ora\index.js:7
const stripAnsi = require('strip-ansi');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module D:\.dev\reactjs\safetalk-emails\node_modules\strip-ansi\index.js from D:\.dev\reactjs\safetalk-emails\node_modules\ora\index.js not supported.
Instead change the require of D:\.dev\reactjs\safetalk-emails\node_modules\strip-ansi\index.js in D:\.dev\reactjs\safetalk-emails\node_modules\ora\index.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (D:\.dev\reactjs\safetalk-emails\node_modules\ora\index.js:7:19)
at Object.<anonymous> (D:\.dev\reactjs\safetalk-emails\node_modules\react-email\dist\source\utils\generate-email-preview.js:10:31)
at Object.<anonymous> (D:\.dev\reactjs\safetalk-emails\node_modules\react-email\dist\source\utils\index.js:20:14)
at Object.<anonymous> (D:\.dev\reactjs\safetalk-emails\node_modules\react-email\dist\source\commands\dev.js:7:17)
at Object.<anonymous> (D:\.dev\reactjs\safetalk-emails\node_modules\react-email\dist\source\index.js:8:15) {
code: 'ERR_REQUIRE_ESM'
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Expected Behavior
Start the dev environment.
What's your node version? (if relevant)
v16.16.0
Hi,
How did you solve this issue ?
Managed to find a workaround:
- Run initial
yarnwhich will create ayarn.lockfile. - Then run
yarn devwhich will create the.react-emailfolder. - Quit and at this point it will not start again.
- Delete
yarn.lockand runyarnagain. - Run
yarn dev
This works with react-email version 1.9.5 node version 18.16.0 and as a standalone version.
cc: @Isos9
For me, deleting yarn.lock and node_modules + reinstalling packages was the fix.
It fixes it once, however, when trying to run email dev a second time, it fails with the original error message
Managed to find a workaround:
* Run initial `yarn` which will create a `yarn.lock` file. * Then run `yarn dev` which will create the `.react-email` folder. * Quit and at this point it will not start again. * Delete `yarn.lock` and run `yarn` again. * Run `yarn dev`This works with react-email version
1.9.5node version18.16.0and as a standalone version. cc: @Isos9
This an issue with yarn https://github.com/eslint/eslint/discussions/17215#discussioncomment-6511704