Installer throws ERR_REQUIRE_ESM when making a clean install
See original GitHub issueWhat version of Remix are you using?
latest
Steps to Reproduce
npx create-remix@latest --template remix-run/blues-stack NAME
Expected Behavior
Would install a project in a folder called NAME.
Actual Behavior
It throws an error
➜ projects npx create-remix@latest --template remix-run/blues-stack PROJECT_NAME
Need to install the following packages:
create-remix@latest
Ok to proceed? (y) y
npm WARN deprecated source-map-url@0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated rollup-plugin-inject@3.0.2: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-inject.
npm WARN deprecated source-map-resolve@0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/create.js:26
var sortPackageJSON = require('sort-package-json');
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/my-username/.npm/_npx/5164864a48bff686/node_modules/sort-package-json/index.js from /Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/create.js not supported.
Instead change the require of index.js in /Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/create.js to a dynamic import() which is available in all CommonJS modules.
at Object.<anonymous> (/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/create.js:26:23)
at Object.<anonymous> (/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/commands.js:29:16)
at Object.<anonymous> (/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/run.js:24:16)
at Object.<anonymous> (/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/cli/index.js:15:11)
at Object.<anonymous> (/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/@remix-run/dev/index.js:15:13)
at Object.<anonymous> (/Users/my-username/.npm/_npx/5164864a48bff686/node_modules/create-remix/cli.js:14:11) {
code: 'ERR_REQUIRE_ESM'
}
Issue Analytics
- State:
- Created a year ago
- Reactions:11
- Comments:14
Top Results From Across the Web
node.js - How would you fix an 'ERR_REQUIRE_ESM' error?
Make sure to run this in the directory in which your package.json file is in! $ npm install. Use the require() statement like...
Read more >Error [ERR_REQUIRE_ESM]: require() of ES Module not ...
What is this? You can solve the "[ERR_REQUIRE_ESM]: require() of ES Module not supported" by doing one of two things: Use ESM -...
Read more >Common errors | npm Docs
Broken npm installation; Random errors; No compatible version found ... Some strange issues can be resolved by simply running npm cache clean and...
Read more >err_require_esm ts-node | The AI Search Engine You Control
Since you're compiling to commonjs modules it will require some transpiling to make them work with ESM. Typescript is adding nodenext as a...
Read more >Node.js v19.3.0 Documentation
strictEqual(actual, expected[, message]); assert.throws(fn[, error][, message]) ... DEP0086: Remove runInAsyncIdScope; DEP0089: require('node:assert') ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
I reported the issue here https://github.com/keithamus/sort-package-json/issues/258
A very quick fix is to replace the version of
sort-package-json
in the npx cache with version 1.55.0e.g. for the error
the problem would be solved with