[英]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.