我是meteor
和Heroku
的新手,并尝试使用Heroku
和mongoDB
地图集从流星设置教程todo应用程序。当我使用meteor
启动该应用程序时,该应用程序可以在具有本地主机的本地计算机上完美运行。现在,我想将其部署在Heroku
上。因此,我创建了一个mongoDB
免费帐户,为所有IP地址添加了白名单,创建了一个对任何数据库都具有读写权限的数据库用户。然后我得到一个看起来像这样的连接字符串(我不确定那是否是流星的正确连接字符串):
mongodb+srv://DATABASEUSER:PASSWORD@todoauto-ivrrg.mongodb.net/test?retryWrites=true
我选择“连接您的应用程序”,并将其选择为驱动程序“ Node.js”,并将其版本选择为“ 3.0或更高版本”。
在下一步中,我创建了我的Heroku
免费帐户,为我的终端下载了CLI
,登录到Heroku
,创建了本地git存储库,创建了新应用,并添加了从“ admithub / meteor-horse”构建包,将MONGO_URL设置为来自MongoDB Atlas的连接字符串,并将ROOT_URL设置为https://todoauto.herokuapp.com。然后我把所有东西都推到了Heroku。
我不确定是否需要从流星更改或添加任何东西到Todo应用程序。当我尝试使用Heroku启动应用程序时,它立即崩溃。我检查了日志,这就是我得到的:
2019-04-04T07:24:36.751039+00:00 heroku[web.1]: Starting process with command `.meteor/heroku_build/bin/node $NODEJS_PARAMS .meteor/heroku_build/app/main.js`
2019-04-04T07:24:40.937843+00:00 heroku[web.1]: Process exited with status 1
2019-04-04T07:24:40.952903+00:00 heroku[web.1]: State changed from starting to crashed
2019-04-04T07:24:40.885782+00:00 app[web.1]: /app/.meteor/heroku_build/app/programs/server/node_modules/fibers/future.js:313
2019-04-04T07:24:40.885811+00:00 app[web.1]: throw(ex);
2019-04-04T07:24:40.885813+00:00 app[web.1]: ^
2019-04-04T07:24:40.885815+00:00 app[web.1]:
2019-04-04T07:24:40.885817+00:00 app[web.1]: Error: cyclic dependency detected
2019-04-04T07:24:40.885825+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:331:34)
2019-04-04T07:24:40.885827+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885828+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885829+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885831+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885833+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885834+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885836+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885837+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885839+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885840+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885842+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885843+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885844+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
2019-04-04T07:24:40.885845+00:00 app[web.1]: at serializeObject (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:345:18)
2019-04-04T07:24:40.885846+00:00 app[web.1]: at serializeInto (/app/.meteor/heroku_build/app/programs/server/npm/node_modules/meteor/npm-mongo/node_modules/bson/lib/bson/parser/serializer.js:934:17)
我希望我的问题能对我有所帮助,我对一切都很陌生,并阅读了许多指南,了解如何与Heroku一起设置流星,并遵循了所有步骤。在尝试启动应用程序之前,我没有收到任何错误。
答案 0 :(得分:0)
连接到MongoDB Atlas数据库时,我遇到了这个问题,该数据库的MongoDB服务器版本为4.0.10(可能太新了,无法与旧示例一起使用)。
请尝试以下示例的分支,它使用节点mongodb驱动程序的更新版本:
https://github.com/onezoomin/todos
即:
git clone https://github.com/onezoomin/todos