且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

Meteor App无法连接到MongoDB?

更新时间:2023-02-05 13:02:24

鉴于堆栈跟踪显示流星仍在尝试连接端口3002上的mongoDb实例,则说明您未正确设置环境变量或您尚未重新加载cmd shell以获取新值.

Given that the stack trace says that meteor is still trying to connect to the mongoDb instance on port 3002, then either you have't set the environment variable properly or you haven't reloaded the cmd shell to get the new value.

您如何设置 MONGO_URL ?如果通过系统属性"进行设置或更新了autoexec.bat,则需要重新加载cmd shell.

How did you set MONGO_URL ? If you set it through the System Properties or updated the autoexec.bat then you'll need to re-load the cmd shell.

您可以通过在cmd shell中键入来查看当前值:

You can see what the current value is by typing in the cmd shell:

echo %MONGO_URL%

然后将其设置为当前环境,即可:

Then to set it for the current env you can do :

set MONGO_URL=mongodb://127.0.0.1:27017/sample