sharvit / mongoose-data-seed

Seed mongodb with data using mongoose models
https://sharvit.github.io/mongoose-data-seed/
MIT License
110 stars 21 forks source link

Not able to run seeders #98

Open rochapablo opened 3 years ago

rochapablo commented 3 years ago

I'm submitting a…

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)

      1. 4.

Environment

jetonk commented 2 years ago

Same here, I have the same issue.