mongoose-data-seed icon indicating copy to clipboard operation
mongoose-data-seed copied to clipboard

Not able to run seeders

Open rochapablo opened this issue 4 years ago • 1 comments

I'm submitting a…

  • [ ] Regression (a behavior that used to work and stopped working in a new release)
  • [ ] Bug report
  • [ ] Feature request
  • [ ] Documentation issue or request
  • [X] Support request

Expected Behavior

Current Behavior

node_modules/.bin/md-seed run --dropdb
Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: md-seed-config.js
require() of ES modules is not supported.
require() of md-seed-config.js from node_modules/mongoose-data-seed/dist/lib/config.js 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 md-seed-config.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from package.json.

    at Module._extensions..js (internal/modules/cjs/loader.js:1080:13)
    at Object.newLoader [as .js] (node_modules/pirates/lib/index.js:104:7)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.loadUserConfig (node_modules/mongoose-data-seed/dist/lib/config.js:127:12)
    at run (node_modules/mongoose-data-seed/dist/lib/commands/run/run.js:36:23)
    at _default (node_modules/mongoose-data-seed/dist/lib/commands/run/index.js:33:27)
    at runCommand (node_modules/mongoose-data-seed/dist/lib/commands/helpers.js:79:10) {
  code: 'ERR_REQUIRE_ESM'
}

Possible Solution

Steps to Reproduce (for bugs)

Environment

  • mongoose-data-seed version: 2.1.6
  • Node version: 14.13.1
  • NPM version: 6.14.8
  • Yarn version (if you use Yarn):
  • Operating system: Mac
  • Link to your project:

rochapablo avatar Oct 12 '20 11:10 rochapablo

Same here, I have the same issue.

jetonk avatar Mar 29 '22 21:03 jetonk