无法启动捆绑的Meteor app:"错误:无法连接到[127.0.0.1:3001]"

时间:2014-12-03 04:57:55

标签: node.js mongodb meteor

我正在尝试捆绑并运行Meteor(v1.0)作为原始Node项目。

以下是我采取的步骤:

  1. $ cd app_dir
  2. $ meteor build build_dir
  3. $ cd build_dir/programs/server
  4. $ npm install
  5. $ cd build_dir
  6. $ PORT=3000 MONGO_URL=mongodb://127.0.0.1:3001/meteor node main.js
  7. 此时我收到错误:

    Exception in callback of async function: Error: failed to connect to [127.0.0.1:3001]
    at null.<anonymous> (/Users/byrnef87/Sites/lookback-site/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/server.js:536:74)
    at emit (events.js:106:17)
    at null.<anonymous> (/Users/byrnef87/Sites/lookback-site/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:150:15)
    at emit (events.js:98:17)
    at Socket.<anonymous> (/Users/byrnef87/Sites/lookback-site/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:516:10)
    at Socket.emit (events.js:95:17)
    at net.js:440:14
    at process._tickCallback (node.js:419:13)
    

    关于可能导致此问题或如何调试它的任何想法?

    谢谢!

2 个答案:

答案 0 :(得分:1)

最终为我修复它的解决方案只是重新克隆repo,将节点升级到最新版本,将MongoDB升级到最新版本并使用ROOT_URL运行它,如下所示:

ROOT_URL=http://localhost:3000 PORT=3000 MONGO_URL=mongodb://127.0.0.1:27017/meteor node main.js

答案 1 :(得分:0)

启动mongodb后,您需要在MONGO_URL中提供正在运行的端口:

PORT=3000 MONGO_URL=mongodb://127.0.0.1:27017/meteor node main.js