Cli: Generate new seed doesn't work

Created on 17 Jun 2018  路  2Comments  路  Source: sequelize/cli

What are you doing?

I try to use the following command:

> npm run sequelize seed:generate --name user

What do you expect to happen?

I expect to have a new file created.

What is actually happening?

It says: Missing required argument: name

"sequelize": "^4.37.10",
"sequelize-cli": "^4.0.0",

Here is the command line, it looks like it can't grab the --name flag.

sequelize "seed:generate" "user"

Sequelize CLI [Node: 10.3.0, CLI: 4.0.0, ORM: 4.37.10]

Options:
--version Show version number [boolean]
--help Show help [boolean]
--env The environment to run the command in [string] [default: "development"]
--config The path to the config file [string]
--options-path The path to a JSON file with additional options [string]
--migrations-path The path to the migrations folder [string] [default: "migrations"]
--seeders-path The path to the seeders folder [string] [default: "seeders"]
--models-path The path to the models folder [string] [default: "models"]
--url The database connection string to use. Alternative to using --config files [string]
--debug When available show various debug information [boolean] [default: false]
--name Defines the name of the seed [string] [required]

Missing required argument: name
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] sequelize: sequelize "seed:generate" "user"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] sequelize script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/vincent/.npm/_logs/2018-06-17T18_40_06_489Z-debug.log

Most helpful comment

What about:

npm run sequelize -- seed:generate --name user

Since you're running it through your package.json, you need to tell NodeJS where to look for args to pass. That's done via the lone --, see the second paragraph here.

All 2 comments

What about:

npm run sequelize -- seed:generate --name user

Since you're running it through your package.json, you need to tell NodeJS where to look for args to pass. That's done via the lone --, see the second paragraph here.

@mikew Thank you! I still need to practice on basics ;) Forgot about this -- to pass arguments 馃憤

Was this page helpful?
0 / 5 - 0 ratings