cli: defining config in .sequelizerc does not work
What you are doing?
I try to run the cli with a configured .sequelizerc, but the cli is printing a error:
sequelize
: Unknown arguments: config, migrations-path, models-path, seeders-path
.sequelizerc :
var path = require('path')
module.exports = {
'config': path.resolve('sequelize.config.js'),
'migrations-path': path.resolve('src', 'migrations'),
'models-path': path.resolve('src', 'models'),
'seeders-path': path.resolve('src', 'seeders'),
}
What do you expect to happen?
Successfully loading the config
What is actually happening?
Unknown arguments: config, migrations-path, models-path, seeders-path
Dialect: postgres Sequelize CLI version: 4.0.0 Sequelize version: 4.34.1
About this issue
- Original URL
- State: open
- Created 6 years ago
- Reactions: 1
- Comments: 18
Move to folder where your project understands with root. As in this example, the project understands the src folder as root. Save the .sequelizerc file to this folder and you’re done! 😃
Not working yet:
I’m getting:
Unknown argument: config
Any solution?
I’m totally a newbie on this but I tried a weird way but it worked. In your .sequelizerc file, delete all lines inside the module.exports = {} // Leave it blank then run ‘sequelize init’ => magic happens. Anyone knows exactly why does this work?
I was having a similar problem and I solved it like so. I had initialized sequelize first built out my models, server, etc. Then, I went back to use a .sequelizerc file and use config.js instead of config.json, that way I could change my database credentials and hide them. I ended up having to go into ./models/index.js and change the following code
to:
This worked for me, but I don’t know if you are having separate issues elsewhere.
The reason is that the sequelize-cli cannot recognize .sequelizerc file which is should be under the root directory. My solution to this is you can migrate with commands like below:
cd build/db && sequelize db:migrate --config database.js
Keep in mind:
I too have found this problem I’m using Sequelize 4.38.0 and Sequelize CLI 4.0.0
yet running
sequelize
without any options returns a list of options I can use but also returns the following warning:WARNING: This version of Sequelize CLI is not fully compatible with Sequelize v4. https://github.com/sequelize/cli#sequelize-support
However, when browsing to that link it simply takes you to the Sequelize CLI landing page where no information can be found on the issue of compatibility.