【发布时间】:2014-10-18 03:56:04
【问题描述】:
我正在使用一个包含 PostgreSQL、NodeJS、SailsJS 和 BackboneJS 的堆栈的项目。我从 git 中提取了客户端和服务器存储库,然后导航到该项目的服务器并尝试运行它:
sails lift
然后我得到这个错误:
/Users/$USER/Documents/Code/$APP/config/adapters.js:39
host: mc.dbSettings.host,
TypeError: Cannot read property 'host' of undefined
其中 mc 是一个 var,它使用 require 语句设置为指向另一个 mainConfig.js 文件。打开该文件,我看到 dbSettings 定义为:
dbSettings: {
host: "localhost",
user: "_appName_",
password: "_password_",
dbName: "_appDB_"
},
并且sails无法初始化是因为没有localhost,或者它不知道它是什么?请帮忙。
【问题讨论】:
-
我确实在 mainConfig.js 文件中使用数据库和用户/密码设置了 PostgreSQL。
-
您使用的是什么版本的 SailJS?来自文档:
Keep in mind that options you define directly in your model definitions will override these settings. Prior to v0.10, adapters were defined in myApp/config/Adapters.js. See v0.9 docs for more info. -
我正在运行 0.10.1 。我是新手,很抱歉你的整个观点都超出了我的想象。是的,我知道这是文档的摘录,但您能否解释一下您通过发布该内容引起了哪些关注?
-
您能出示您的
require声明吗?另外,试试console.log(mc)看看它在控制台中输出了什么?
标签: javascript node.js postgresql localhost sails.js