actionhero / ah-sequelize-plugin

sequelize plugin for actionhero
36 stars 23 forks source link

ERROR: Error reading "sequelize.js". #366

Closed alexsvt2 closed 3 years ago

alexsvt2 commented 3 years ago

Hi, I followed the guide to config the sequelize-cli, and after making a migration actionhero crash

(the file sequelize.js doesn't exist into dist/config) but I'm not sure how to make this work.

this is the error

PS C:\Users\Derevo\project> npx sequelize-cli db:migrate

Sequelize CLI [Node: 14.17.6, CLI: 6.2.0, ORM: 6.6.5]

ERROR: Error reading "sequelize.js". Error: Error: Cannot find module './dist/config/sequelize.js'
Require stack:
- C:\Users\Derevo\project\dist\config\sequelize.js
- C:\Users\Derevo\project\sequelize.js
- C:\Users\Derevo\project\node_modules\sequelize-cli\lib\helpers\config-helper.js
- C:\Users\Derevo\project\node_modules\sequelize-cli\lib\helpers\index.js
- C:\Users\Derevo\project\node_modules\sequelize-cli\lib\commands\init.js
- C:\Users\Derevo\project\node_modules\sequelize-cli\lib\sequelize`

This is the project directory

image

evantahler commented 3 years ago

Can you share your actionhero project? It looks like you didn't compile your src to dist... but that shouldn't be required either. Are all your import statement referencing relative files (no src or dist)?

alexsvt2 commented 3 years ago

Hello, I was reading the tutorial in this part. (see screenshot)

Here is the repository https://github.com/alexsvt2/actionhero-crud if you want see if everything is ok

image

and in the sequelizeConfig, they refer to a file located into dist, but I changed the code according to your commentary

now is

const sequelizeConfig = require("./src/config/sequelize.js");

instead of

const sequelizeConfig = require("./dist/config/sequelize.js");

And now it is working. I appreciate your help.

evantahler commented 3 years ago

Ah! Thanks!

I'll update the readme a bit https://github.com/actionhero/ah-sequelize-plugin/pull/367