ERROR: require() of ES Module F:\Node\Alura\orm-sequelize\api\seeders\20221027102559-demo-pessoa.js from F:\Node\Alura\orm-sequelize\node_modules\umzug\lib\migration.js not supported. 20221027102559-demo-pessoa.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.Instead rename 20221027102559-demo-pessoa.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in F:\Node\Alura\orm-sequelize\package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
Solução:
- Crie um arquivo package.json na pasta seeders com o seguinte conteúdo: { "type": "commonjs" }
- Salve e execute novamente: npx sequelize-cli db:seed:all