使用 NodeJS 时无法连接 mongodb 服务器 [英] Unable to connect the mongodb server while using NodeJS

查看:135
本文介绍了使用 NodeJS 时无法连接 mongodb 服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017在 Timeout._onTimeout (D:\javascriptApps\node_modules\mongodb\lib\core\sdam\topology.js:428:30)

解决方案

错误 ECONNREFUSED 只是连接被拒绝.本地 127.0.0.1:27017 上没有进程端点侦听

在连接数据库之前,请确保安装 mongodb 并启动数据库服务器.从命令提示符,转到 mongo 安装所在的位置并运行命令:

mongod --port 27017 --dbpath C:\path_to_data_folder

您可能会发现它很有用 启动 MondoDB 进程

MongoServerSelectionError: connect ECONNREFUSED 127.0.0.1:27017 at Timeout._onTimeout (D:\javascriptApps\node_modules\mongodb\lib\core\sdam\topology.js:428:30)

解决方案

The error ECONNREFUSED is nothing but the connection have been refused. There is no process endpoint listening on local 127.0.0.1:27017

Before connecting to the database, make sure to install mongodb and start the database server. From command prompt, go to where your mongo installations is situated and run command:

mongod --port 27017 --dbpath C:\path_to_data_folder

You may find it useful Start MondoDB Process

这篇关于使用 NodeJS 时无法连接 mongodb 服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆