sequelize需要typeError

时间:2016-03-28 19:21:38

标签: javascript node.js npm sequelize.js

我试图将sequelize orm添加到我的EMPTY项目中,并出现问题。我要做的第一件事是express-generator创建空项目,接下来我写npm install --save sequelizenpm install --save pg pg-hstore。然后,在新生成的文件中,我只添加一行require('sequelize');,并收到错误:

e:\nodeproj\node_modules\sequelize\lib\utils\validator-extras.js:78
  validator.extend(key, extend);
            ^
TypeError: Object  has no method 'extend'
    at module.exports.extensions (e:\nodeproj\node_modules\sequelize\lib\utils\validator-extras.js:78:13)
    at e:\nodeproj\node_modules\sequelize\node_modules\lodash\lodash.js:4040:15
    at baseForOwn (e:\nodeproj\node_modules\sequelize\node_modules\lodash\lodash.js:2573:24)
    at e:\nodeproj\node_modules\sequelize\node_modules\lodash\lodash.js:4009:18
    at Function.forEach (e:\nodeproj\node_modules\sequelize\node_modules\lodash\lodash.js:7634:11)
    at Object.<anonymous> (e:\nodeproj\node_modules\sequelize\lib\utils\validator-extras.js:77:3)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (e:\nodeproj\node_modules\sequelize\lib\instance-validator.js:3:17)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)

我尝试过不同的版本,但效果相同。提前谢谢!

UPD:

package.json文件:

{
  "name": "nodeproj",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.13.2",
    "cookie-parser": "~1.3.5",
    "debug": "~2.2.0",
    "express": "~4.13.1",
    "jade": "~1.11.0",
    "morgan": "~1.6.1",
    "node-sass-middleware": "0.8.0",
    "serve-favicon": "~2.3.0",
    "sequelize": "~3.20.0",
    "pg-hstore": "~2.3.2",
    "pg": "~4.5.1"
  }
}

0 个答案:

没有答案