How to declare a sequelize-auto in nodejs program?

亡梦爱人 提交于 2019-12-12 04:18:23

问题


When I am declaring a sequelize-auto in my program I'm getting an error like o is not defined.I tried so many ways to rectify this problem but it doesn't work.I referred this link (https://github.com/sequelize/sequelize-auto).

My Code is

var Sequelizeauto = require('sequelize-auto');
var tableCreatin = new Sequelizeauto -o [modelPath] -d <loginform> -h <localhost> -u <root> -p <3306> -x <root> -e [mysql];

Error

ReferenceError: o is not defined
    at Object.<anonymous> (D:\NodeProject\Sequeliser\server.js:23:39)
    at Module._compile (module.js:434:26)
    at Object.Module._extensions..js (module.js:452:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:475:10)
    at startup (node.js:118:18)
    at node.js:952:3

回答1:


You must run command sequelize-auto -o "./models" -d sequelize_auto_test -h localhost -u my_username -p 5432 -x my_password -e postgres in termintal, its not a JS code.




回答2:


I am using grunt to run this command. I was getting the same error when I was running grunt schema command. It got resolved by installing sequelize-auto globally: npm install -g sequelize-auto

Hope this was helpful.



来源:https://stackoverflow.com/questions/34525480/how-to-declare-a-sequelize-auto-in-nodejs-program

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!