Solucionado (ver solução)
Solucionado
(ver solução)
1
resposta

Error: Cannot find module './dialects/mysql/data-types'

Quando eu tenho execultar esse comando "node api/db/criarTabelas.js" me aparece esse erro:

internal/modules/cjs/loader.js:888 throw err; ^

Error: Cannot find module './dialects/mysql/data-types' Require stack:

  • /home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/data-types.js
  • /home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/utils.js
  • /home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/sequelize.js
  • /home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/index.js
  • /home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/api/routes/fornecedores/ModeloTabelaFornecedor.js
  • /home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/api/db/criarTabelas.js at Function.Module.resolveFilename (internal/modules/cjs/loader.js:885:15) at Function.Module.load (internal/modules/cjs/loader.js:730:27) at Module.require (internal/modules/cjs/loader.js:957:19) at require (internal/modules/cjs/helpers.js:88:18) at Object. (/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/data-types.js:1055:20) at Module.compile (internal/modules/cjs/loader.js:1068:30) at Object.Module.extensions..js (internal/modules/cjs/loader.js:1097:10) at Module.load (internal/modules/cjs/loader.js:933:32) at Function.Module.load (internal/modules/cjs/loader.js:774:14) at Module.require (internal/modules/cjs/loader.js:957:19) { code: 'MODULENOT_FOUND', requireStack: [ '/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/data-types.js', '/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/utils.js', '/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/lib/sequelize.js', '/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/node_modules/sequelize/index.js', '/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/api/routes/fornecedores/ModeloTabelaFornecedor.js', '/home/estevao/Documentos/Alura/NodeJs-Studies/api-petshop/api/db/criarTabelas.js' ] }
1 resposta
solução!

resolvi o problema copiando a pasta mysql em node_modules/sequelize/lib/dialects, do repositorio da sequelize, dentro do meu projeto. link da pasta no repositorio. https://github.com/sequelize/sequelize/tree/main/lib/dialects/mysql