我正在尝试捆绑并运行Meteor(v1.0)作为原始Node项目。
以下是我采取的步骤:
$ cd app_dir
$ meteor build build_dir
。 $ cd build_dir/programs/server
$ npm install
$ cd build_dir
$ PORT=3000 MONGO_URL=mongodb://127.0.0.1:3001/meteor node main.js
此时我收到错误:
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)
关于可能导致此问题或如何调试它的任何想法?
谢谢!
答案 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