cli
cli copied to clipboard
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
I confirm the message being present after updating sequelize-cli from 3.9 to 4. However, it seems that it has no effect on execution results whatsoever. At least migrations and seeds are running as expected. Dialect: mysql, Sequelize CLI v.4 Sequelize v.4.33
Having the same issue
I'm having the same issue. My versions are:
Sequelize CLI [Node: 8.4.0, CLI: 4.0.0, ORM: 4.37.5]
Although downgrading to v3.2.0 of the Sequelize CLI generates the same error:
Sequelize CLI [Node: 8.4.0, CLI: 3.2.0, ORM: 4.37.5]
Unknown arguments: config, migrations-path, seeders-path, models-path
Same problem here.
I'm getting "Cannot find "/app/.config/sequelize-config.json". Have you run "sequelize init"?" although the file is there.
Same problem here.
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.
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:
- sequelize-cli is installed globally
- database file is under build/db
- migrations, models, seeders directory is also under build/db (if not you can also specify them base on under commands)

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! :)

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'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 tried this too and it worked, Apparently, sequelize does not require you to explicitly define path, once you run the command sequelize init from your root directory it would automatically create those folders from your root directory.
Yep this works for me too...
Still does not work in sequelize 5.5.0.
My folder structure is like /db/migrations, /db/seeds, /db/models. Running commands locally works fine and .sequelizerc recognizes the paths, but when building a docker image the commands fail with the error, "Could not find config.json"
Please help.
My versions are as follows: Sequelize CLI [Node: 12.4.0, CLI: 5.5.0, ORM: 6.0.0]
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
const config = require(__dirname + '/../config/config.json')[env];
to:
const config = require(__dirname + '/../config/config.js')[env];
This worked for me, but I don't know if you are having separate issues elsewhere.
@shaunwcolley While this issue is about the sequelize-cli tool that must be called from the command line, you solved my problem too. Of course require will not react to .sequelizerc. The fact that we both wound up here highlights some confusion resulting from using the (very convenient) models/index.js sample code, and later trying to make more advanced Sequelize changes whose documentation was not written with that sample in mind. Thanks!
Not working yet:
Sequelize CLI [Node: 12.8.1, CLI: 5.5.1, ORM: 5.21.4]
5.5.1
I'm getting: Unknown argument: config
Any solution?
@diegoulloao related to the node version. my problem was fixed
I'm facing this issue as well, only when I run sequelize with no arguments (sequelize init works fine)
Sequelize CLI [Node: 16.13.0, CLI: 4.1.1, ORM: 6.12.1]
My .sequelizerc
require('@babel/register')
const path = require('path')
module.exports = {
'config': path.resolve('config', 'sequelize.json'),
'models-path': path.resolve('src', 'models'),
'migrations-path': path.resolve('src', 'migrations'),
}