0

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
John Carlo
  • 54
  • 2
  • 13

3 Answers3

3

Check your .sequelizerc

const path = require('path')

module.export = {
    'config': path.resolve('config', 'config.js')
}
Som on Mel
  • 31
  • 4
1

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

John Carlo
  • 54
  • 2
  • 13
1

When I got this error (and I know this is uncommon, but it might be useful) it turned out I was running node v6.13.4. The reason is because I am using nvm and that defaults to that node version.

Check the version of node that you are using

node --version
6.13.4

If you are not using nvm, update your version of node by some method. If you are, you can just tell nvm to fix it.

nvm install stable
nvm use stable