Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/mongodb/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/meteor/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Mongodb 在本地主机上运行Meteor失败,RangeError:端口应为>;=0及<;65536:NaN_Mongodb_Meteor_Localhost - Fatal编程技术网

Mongodb 在本地主机上运行Meteor失败,RangeError:端口应为>;=0及<;65536:NaN

Mongodb 在本地主机上运行Meteor失败,RangeError:端口应为>;=0及<;65536:NaN,mongodb,meteor,localhost,Mongodb,Meteor,Localhost,我正在使用node和Mongodb在localhost上运行一个项目,但是当我尝试在数据库上创建集合时,它就失败了,并出现了一个错误 我正在使用以下脚本构建项目: cd ~/Meteor/daily-reminder meteor build ~/build-output-daily-reminder --server=http://localhost cd ~/build-output-daily-reminder tar -xvzf daily-reminder.tar.gz rm dail

我正在使用node和Mongodb在localhost上运行一个项目,但是当我尝试在数据库上创建集合时,它就失败了,并出现了一个错误

我正在使用以下脚本构建项目:

cd ~/Meteor/daily-reminder
meteor build ~/build-output-daily-reminder --server=http://localhost
cd ~/build-output-daily-reminder
tar -xvzf daily-reminder.tar.gz
rm daily-reminder.tar.gz
cd ~/build-output-daily-reminder/bundle
(cd programs/server && npm install)
export MONGO_URL='mongodb://username:password@http://localhost:27017/daily-reminder'
export ROOT_URL='http://localhost/'
export PORT='3000'
echo "now run node main.js"
node main.js
(我在真实代码中使用实际的mongodb用户名和密码)

该项目构建良好,但节点不会运行。它会生成以下错误:

now run node main.js
/home/shelagh/build-output-daily-reminder/bundle/programs/server/node_modules/fibers/future.js:245
                        throw(ex);
                              ^
RangeError: port should be >= 0 and < 65536: NaN
    at Socket.connect (net.js:917:13)
    at Object.exports.connect.exports.createConnection (net.js:92:35)
    at [object Object].Connection.start (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection.js:173:29)
    at _connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:211:16)
    at [object Object].ConnectionPool.start (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:231:3)
    at Server.connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/connection/server.js:708:18)
    at Db.open (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/db.js:281:23)
    at connectFunction (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/mongo_client.js:275:67)
    at Function.MongoClient.connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/mongo_client.js:345:5)
    at Function.Db.connect (/home/shelagh/build-output-daily-reminder/bundle/programs/server/npm/mongo/node_modules/mongodb/lib/mongodb/db.js:2094:23)
服务器尝试与数据库通信时,似乎出现了一些问题。但我看不出我的MONGO_URL有什么问题:端口被指定为27017。从错误中可以看出,端口似乎没有被传入


我使用的是节点v0.12.7和MongoDB shell版本:2.4.9。我通过在单独的终端窗口中键入“mongo”启动了mongo。

您的
mongo\u URL
错误,它重新定义了指定主机的协议

改变

export MONGO_URL='mongodb://username:password@http://localhost:27017/daily-reminder'


您正在运行哪个shell?更新:如果改用此MONGO_URL:export MONGO_URL=mongodb://username:password@localhost:27017/每日提醒'然后我得到一个不同的错误:/home/shelagh/build-output-daily-rementer/bundle/programs/server/node_-modules/fibers/future.js:278 throw(ex);^MongoError:Object.Future.wait的身份验证失败(/home/shelagh/build output daily rements/bundle/programs/server/node_modules/fibers/Future.js:398:15)我确信我使用了安装mongo时创建的正确用户名和密码。但我不知道如何检查这个。MongoDB shell版本:2.4.9Cristian Fritz是对的。我现在可以用了。事实证明,我还需要解决另一件事。我的设置的正确值是:export MONGO_URL='1!'mongodb://localhost:27017/daily-提醒‘我想这是因为我刚刚安装了MongoDB,除了主管理员之外,没有创建任何其他用户。我了解到:如果您的MONGO_URL格式错误,节点将退出并出错。如果您尚未在本地mongo上配置任何内容,请不要输入任何用户名和密码。非常感谢你的帮助,非常感谢。
export MONGO_URL='mongodb://username:password@http://localhost:27017/daily-reminder'
export MONGO_URL='mongodb://username:password@localhost:27017/daily-reminder'