Search code examples
node.jssequelize.jssequelize-cli

Invalid or unexpected token in creating model with Sequelize-cli


I`m in the right path, but it is resulting in error

Windows command line:

npx sequelize model:generate --name User --attributes firstName:string,lastName:string,email:string,password:string

output:

Invalid or unexpected token

Solution

  • First, you need to execute the init command:

    $npx sequelize-cli init

    Second, your syntax is wrong. It should be:

    $ npx sequelize-cli model:generate --name User --attributes firstName:string,lastName:string,email:string

    Your syntax is just $npx-sequelize mode:migrate it lacks -cli