feathersjs / feathers

The API and real-time application framework
https://feathersjs.com
MIT License
14.97k stars 742 forks source link

ERR_REQUIRE_ESM when creating a new feathers project #3392

Closed patamimbre closed 5 months ago

patamimbre commented 5 months ago

Steps to reproduce

Run npm create feathers@latest feathers-chat as described in the docs

Expected behavior

It should create a base project

Actual behavior

It throws ERR_REQUIRE_ESM error

/Users/patamimbre/.npm/_npx/eb274edb682bcb28/node_modules/create-feathers/bin/create-feathers:7
const { Command, commandRunner, chalk } = require('@feathersjs/cli')
                                          ^

Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/patamimbre/.npm/_npx/eb274edb682bcb28/node_modules/@feathersjs/cli/lib/index.js from /Users/patamimbre/.npm/_npx/eb274edb682bcb28/node_modules/create-feathers/bin/create-feathers not supported.
Instead change the require of index.js in /Users/patamimbre/.npm/_npx/eb274edb682bcb28/node_modules/create-feathers/bin/create-feathers to a dynamic import() which is available in all CommonJS modules.
    at Object.<anonymous> (/Users/patamimbre/.npm/_npx/eb274edb682bcb28/node_modules/create-feathers/bin/create-feathers:7:43) {
  code: 'ERR_REQUIRE_ESM'
}

System configuration

Module versions (especially the part that's not working): create-feathers@5.0.15

NodeJS version: v21.5.0 (tried with node v20 too)

Operating System: Macos Sonoma 14.2.1

daffl commented 5 months ago

Whoops, thank you. Should be fixed in 5.0.16