在节点v5上使用sqlite dialict进行续集

时间:2015-11-22 17:43:37

标签: node.js sqlite ubuntu sequelize.js

这是我的代码:

var Sequelize = require('sequelize');

var sequelize = new Sequelize(undefined,undefined, undefined, {
  dialect: 'sqlite',
  // SQLite only
  storage: 'database.db'
});

错误是:

/node_modules/sequelize/lib/sequelize.js:205
    throw new Error('The dialect ' + this.getDialect() + ' is not supported. S
          ^
Error: The dialect sqlite is not supported. Supported dialects: mariadb, mssql, mysql, postgres, and sqlite. (Error: Please install sqlite3 package manually)
    at new Sequelize (/home/josecarlos/WebstormProjects/sequelize-test/node_modules/sequelize/lib/sequelize.js:205:11)
    at Object.<anonymous> (/home/josecarlos/WebstormProjects/sequelize-test/index.js:2:17)
    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 Function.Module.runMain (module.js:497:10)
    at startup (node.js:119:16)
    at node.js:902:3

Process finished with exit code 8

节点版本5

的package.json

{
  "name": "sequlisze-test",
  "description": "The API server for an ERP.",
  "version": "0.0.1",
  "private": true,
  "dependencies": {
    "sequelize": "^3.14.1",
    "sqlite3": "^3.1.1"
  }
}

SO:Kubuntu 15.10 / 4.2.0-19-generic#23-Ubuntu SMP Wed Nov 11 11:39:30 UTC 2015 x86_64 x86_64 x86_64 GNU / Linux

我是saled的sqlite:SQLite版本2.8.17。

先谢谢你。

Jose Carlos Ramos Carmenates

1 个答案:

答案 0 :(得分:4)

问题是节点v5和sqlite3,我解决了它:

1-删除node_modules文件夹。

2-回调到节点v0.10.25

nvm use system

3-验证节点版本:

node -v

4-安装sequelize和sqlite

npm install --save sequelize sqlite3

...... ......