[BUG] Error [ERR_REQUIRE_ESM]: require() of ES Module
Describe the bug
After creating a new application with the npm create refine-app@latest testapp command, the application does not start with the nmp run dev command and the following error occurs:
> [email protected] refine
> refine
/home/user/testapp/node_modules/node-emoji/lib/index.cjs:47
var import_is2 = __toESM(require("@sindresorhus/is"), 1);
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/user/testapp/node_modules/@sindresorhus/is/dist/index.js from /home/user/testapp/node_modules/node-emoji/lib/index.cjs not supported.
Instead change the require of index.js in /home/user/testapp/node_modules/node-emoji/lib/index.cjs to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/home/user/testapp/node_modules/node-emoji/lib/index.cjs:47:26)
at Object.<anonymous> (/home/user/testapp/node_modules/marked-terminal/index.cjs:10:13)
at Object.<anonymous> (/home/user/testapp/node_modules/@refinedev/cli/dist/cli.js:25:1400) {
code: 'ERR_REQUIRE_ESM'
}
Steps To Reproduce
npm create refine-app@latest testapp
✔ Choose a project template · refine-vite
✔ What would you like to name your project?: · testapp
✔ Choose your backend service to connect: · data-provider-strapi-v4
✔ Do you want to use a UI Framework?: · antd
✔ Do you want to add example pages?: · no
✔ Do you need i18n (Internationalization) support?: · no
cd testappnpm run dev
Expected behavior
Run normally.
Screenshot
No response
Desktop
No response
Mobile
No response
Additional Context
OS: ubuntu 22.04 LTS Node: v20.9.0 NPM: v10.1.0 create-refine-app: v1.12.1
I have the same error, impossible to run dev a new project
Same exact issue here with a totally fresh install of all the toolchain on a Mac(NVM/NPM/Node, etc ). Impossible to continue.
I also tried to use a older version of refin-eapp and still no go: npm create [email protected] -- -o refine-mui tutorial2
Can you provide your packge-lock.json so we can move on?
I too have got the same issue, impossible to run a new latest refine project.
Sorry for the issue! 🙏 We've just opened a PR to fix it. It will be released as soon as workflows are complete! 🚀
Just created a new project which includes the latest update to node-emoji: 2.1.0, and I'm getting the exact same error
I'm getting the exact same error too with a new project I use this command :
npm create refine-app@latest
Hello folks, using the command npm create refine-app@latest testapp, couldn't reproduce the problem, as you can see in the screenshot, it works as expected. I can see the welcome page as expected, could you double-check your configuration or provide a minimal reproducible example if possible?
Here you go:repo
Also note I found that when I run npm ls node-emoji, I get this output:
[email protected] /Users/ex/Desktop/refine-admin/refine-repro
└─┬ @refinedev/[email protected]
├─┬ [email protected]
│ └── [email protected]
└── [email protected]
Looks like 2.1.1 is coming from [email protected]
Hi @BatuhanW, I use this configuration
then when I use pnpm dev I got this error
Hello folks, it seems we still have this issue with yarn and pnpm package managers. As a temporary workaround, you can use npm to install dependencies.
Also we've noticed that a new version is released 15 minutes ago, we'll upgrade to use it.
https://www.npmjs.com/package/node-emoji/v/2.1.2
https://github.com/omnidan/node-emoji/pull/154
https://github.com/omnidan/node-emoji/issues/153
Can confirm using npm with the latest now works. Thanks!
Hiyall - this was me, sorry about that. I'd neglected to fully test a tooling upgrade for node-emoji that bumped dependencies, enabled auto-updates via Renovate for others, and didn't add an end-to-end test that CommonJS consumers wouldn't be broken.
[email protected] is published now and should be working for CommonJS consumers again. Please do let us know in https://github.com/omnidan/node-emoji if anything else gets / is broken!
Also, copying here in case it's useful for this or similar situations: a workaround that should work across package managers in the case of a dependency breaking, including a deep dependency-of-a-dependency, is using an overrides/resolutions style pin.
- npm: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#overrides
- pnpm: https://pnpm.io/package_json#pnpmoverrides (secondary: https://pnpm.io/package_json#resolutions)
- Yarn classic: https://classic.yarnpkg.com/lang/en/docs/selective-version-resolutions/
- Yarn berry/2+: https://yarnpkg.com/cli/set/resolution
Cheers! 👋
Thanks a lot @JoshuaKGoldberg, tested with pnpm, and I can confirm, it works as expected!