Node.js 的 SQLite 教程中的一个问题

飞来飞去1 发布于 2018/07/17 20:45
阅读 88
收藏 0
// main.js

const Promise = require('bluebird')
const AppDAO = require('./dao')
const ProjectRepository = require('./project_repository')
const TaskRepository = require('./task_repository')

function main() {
    const dao = new AppDAO('./database.sqlite3')
    const blogProjectData = { name: 'Write Node.js - SQLite Tutorial' }
    const projectRepo = new ProjectRepository(dao)//这一行报错
    const taskRepo = new TaskRepository(dao)
    let projectId

下面的是报错的内容:

F:\node-sqlite-tutorial>node main.js                                                                            F:\node-sqlite-tutorial\main.js:11
    const projectRepo = new ProjectRepository(dao)
                                      ^

TypeError: ProjectRepository is not a constructor
    at main (F:\node-sqlite-tutorial\main.js:11:25)
    at Object.<anonymous> (F:\node-sqlite-tutorial\main.js:65:1)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3                                                                                           

加载中
返回顶部
顶部