Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/39.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
Node.js 错误:无法使用MongoDB在null连接到[127.0.0.1:27017]_Node.js_Mongodb_Express - Fatal编程技术网

Node.js 错误:无法使用MongoDB在null连接到[127.0.0.1:27017]

Node.js 错误:无法使用MongoDB在null连接到[127.0.0.1:27017],node.js,mongodb,express,Node.js,Mongodb,Express,我正在尝试运行节点应用程序并不断收到此错误。不确定从何处开始: events.js:85 throw er; // Unhandled 'error' event ^ Error: failed to connect to [127.0.0.1:27017] at null.<anonymous> (/Users/dte/limetime-dev/node_modules/mongoose/node_modules/mongodb/lib/

我正在尝试运行节点应用程序并不断收到此错误。不确定从何处开始:

events.js:85
      throw er; // Unhandled 'error' event
            ^
Error: failed to connect to [127.0.0.1:27017]
    at null.<anonymous> (/Users/dte/limetime-dev/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/server.js:557:74)
    at emit (events.js:118:17)
    at null.<anonymous> (/Users/dte/limetime-dev/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
    at emit (events.js:110:17)
    at Socket.<anonymous> (/Users/dte/limetime-dev/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection.js:534:10)
    at Socket.emit (events.js:107:17)
    at net.js:451:14
    at process._tickDomainCallback (node.js:381:11)
events.js:85
投掷者;//未处理的“错误”事件
^
错误:无法连接到[127.0.0.1:27017]
在空。(/Users/dte/limetime-dev/node_-modules/mongoose/node_-modules/mongodb/lib/mongodb/connection/server.js:557:74)
在发出时(events.js:118:17)
在空。(/Users/dte/limetime dev/node_modules/mongoose/node_modules/mongodb/lib/mongodb/connection/connection_pool.js:156:15)
在发出时(events.js:110:17)
在插座上。(/Users/dte/limetime-dev/node_-modules/mongoose/node_-modules/mongodb/lib/mongodb/connection/connection.js:534:10)
在Socket.emit(events.js:107:17)
net.js:451:14
在进程中。_tickDomainCallback(node.js:381:11)

该错误表示您的mongodb未运行或正在不同的端口上运行。 节点应用程序无法为您管理mongoDB。
因此,在运行应用程序之前,请确保mongodb正在端口27017上运行。

该错误表示mongodb未在当前主机上运行。确保MongoDB正在运行。查看有关安装MongoDB的说明。

从这里开始:您可能需要阅读,这大大提高了获得有用答案的可能性。你可能会发现这篇优秀的文章也很有帮助。投票结束这个问题是因为它缺少一个答案。