简体   繁体   English

故障 - MongoError:无法连接到服务器 [未定义:27017]

[英]Glitch - MongoError: failed to connect to server [undefined:27017]

I am going through FreeCodeCamp 's curriculum.我正在学习 FreeCodeCamp的课程。 I am still a back end newbie.我仍然是后端新手。

I am currently in this project.我目前在这个项目中。 In order do the project, we are supposed to "fork" it in Glitch or GitHub.为了做这个项目,我们应该在 Glitch 或 GitHub 中“分叉”它。

Start this project on Glitch using this link or clone this repository on GitHub, If you use Glitch, remember to save the link to your project somewhere safe!使用链接在 Glitch 上启动此项目或在 GitHub 上克隆此存储库,如果您使用 Glitch,请记住将项目的链接保存在安全的地方!

However, as soon as I fork the project I am getting this error:但是,一旦我分叉项目,我就会收到此错误:

MongoError: failed to connect to server [undefined:27017] on first connect [MongoError: getaddrinfo ENOTFOUND undefined undefined:27017]

The only thing I touched is mongoose.connect in order to link my database.我唯一接触的是mongoose.connect以链接我的数据库。

mongoose.connect(process.env.MLAB_URI)

Thank you in advance!先感谢您!

Well... I am ashamed of answering my own question like this:嗯......我很惭愧这样回答我自己的问题:

People, don't forget the quotes (or double quotes) at the beginning and end of your database URI.各位,不要忘记数据库 URI 开头和结尾的引号(或双引号)。

Inside.env file ---> Variable Name = "Your URI" Inside.env 文件 ---> 变量名 = “你的 URI”

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 MongoError:无法连接到服务器[localhost:27017] - MongoError: failed to connect to server [localhost:27017] MongoError:首次连接时无法连接到服务器[localhost:27017] [MongoError:连接ECONNREFU SED 127.0.0.1:27017] - MongoError: failed to connect to server [localhost:27017] on first connect [MongoError: connect ECONNREFU SED 127.0.0.1:27017] NodeJS Express JS-MongoError:无法连接到服务器 - NodeJS Express JS - MongoError: failed to connect to server UnhandledPromiseRejectionWarning: MongoNetworkError: 在第一次连接时无法连接到服务器 [localhost:27017] [MongoNetworkError] - UnhandledPromiseRejectionWarning: MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError MongoNetworkError:首次连接时无法连接到服务器[localhost:27017] - MongoNetworkError: failed to connect to server [localhost:27017] on first connect 我收到错误消息:无法连接到[undefined:27017] - I am getting Error: failed to connect to [undefined:27017] 错误:无法连接到[localhost:27017] - Error: failed to connect to [localhost:27017] MongoError:服务器localhost:27017收到错误{“名称”:“ MongoError”,“消息”:“读取ECONNRESET”} - MongoError: server localhost:27017 received an error {“name”:“MongoError”,“message”:“read ECONNRESET”} 无法将Mongodb连接到Node.js:throw er; //未处理的“错误”事件^错误:无法连接到[undefined:27017] - Can't connect Mongodb to Node.js : throw er; // Unhandled 'error' event ^ Error: failed to connect to [undefined:27017] 未处理的拒绝MongoError:无法连接到MongoDB中的服务器 - Unhandled rejection MongoError: cannot connect to server in MongoDB
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM