我正在尝试在Windows上运行流星应用程序。我在我的机器上运行了本地mongodb,我还在我的系统上设置了环境变量<b>MONGO_URL=mongodb://127.0.0.1:27017/sample</b>
。仍然流星应用程序无法连接到它。可能是什么问题。
以下是错误: -
C:\workspace\node-workspace\gm>meteor
[[[[[ C:\workspace\node-workspace\gm ]]]]]
=> `Meteor server running on: <b>http://127.0.0.1:3000/</b>`
app/packages/mongo-livedata/mongo_driver.js:113
throw err;
^
Error: failed to connect to [127.0.0.1:3002]
at Server.connect.connectionPool.on.server._serverState (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongo
db\connection\server.js:564:74)
at EventEmitter.emit (events.js:126:20)
at connection.on._self._poolState (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongodb\connection\connecti
on_pool.js:124:15)
at EventEmitter.emit (events.js:99:17)
at Socket.errorHandler (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongodb\connection\connection.js:465:1
0)
at Socket.EventEmitter.emit (events.js:96:17)
at Socket._destroy.self.errorEmitted (net.js:329:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
=> Exited with code: 1
=> Meteor server restarted
app/packages/mongo-livedata/mongo_driver.js:113
throw err;
^
Error: failed to connect to [127.0.0.1:3002]
at Server.connect.connectionPool.on.server._serverState (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongo
db\connection\server.js:564:74)
at EventEmitter.emit (events.js:126:20)
at connection.on._self._poolState (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongodb\connection\connecti
on_pool.js:124:15)
at EventEmitter.emit (events.js:99:17)
at Socket.errorHandler (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongodb\connection\connection.js:465:1
0)
at Socket.EventEmitter.emit (events.js:96:17)
at Socket._destroy.self.errorEmitted (net.js:329:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
=> Exited with code: 1
=> Meteor server restarted
app/packages/mongo-livedata/mongo_driver.js:113
throw err;
^
Error: failed to connect to [127.0.0.1:3002]
at Server.connect.connectionPool.on.server._serverState (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongo
db\connection\server.js:564:74)
at EventEmitter.emit (events.js:126:20)
at connection.on._self._poolState (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongodb\connection\connecti
on_pool.js:124:15)
at EventEmitter.emit (events.js:99:17)
at Socket.errorHandler (C:\Program Files (x86)\Meteor\packages\mongo-livedata\.npm\node_modules\mongodb\lib\mongodb\connection\connection.js:465:1
0)
at Socket.EventEmitter.emit (events.js:96:17)
at Socket._destroy.self.errorEmitted (net.js:329:14)
at process.startup.processNextTick.process._tickCallback (node.js:244:9)
=> Exited with code: 1
=> Your application is crashing. Waiting for file change.
答案 0 :(得分:2)
鉴于堆栈跟踪显示meteor仍在尝试连接到端口3002上的mongoDb实例,那么要么您没有正确设置环境变量,要么您没有重新加载cmd shell以获取新值。
您是如何设置 MONGO_URL 的?如果通过系统属性进行设置或更新autoexec.bat,则需要重新加载cmd shell。
您可以通过键入cmd shell来查看当前值:
echo %MONGO_URL%
然后将其设置为您可以执行的当前环境:
set MONGO_URL=mongodb://127.0.0.1:27017/sample
答案 1 :(得分:1)
我知道这已经有一段时间了,但我遇到了同样的问题(7月13日)我没有时间弄明白并最终进入Linux安装工作正常。
最近我有时间回到它。以下是google群组中关于此事的一些讨论 - https://groups.google.com/forum/#!topic/meteor-talk/AE6GYrJImAo
我发现Mongo数据库进程甚至没有启动,mongo_runner.js中有些冲突...我的解决方案是手动启动mongo
C:\Program Files (x86)\Meteor\mongodb\bin>mongod -port 3002 --dbpath C:\Users\username\project\.meteor\local\db
上面在所需端口上启动项目,并指定项目的数据库文件夹......之后就像往常一样启动流星。
答案 2 :(得分:0)
从版本0.7.1开始,流星mongodb端口为3001,而不是3002.
与Meteor运行的端口相比,端口通常高1(在旧版本的流星版本中为2)。例如,如果Meteor在端口3000上运行,MongoDB将在端口3001