nodejs 连接mongoose 报错 connect ECONNREFUSED怎么解决呢?
https://github.com/jaywcjlove/nxylene
一般情况本地调试不报错,在使用coding.net 中的演示功能,连接mongodb的时候就报下面的错误,无法运行。
/home/vcap/app/node_modules/connect-mongo/node_modules/mongodb/lib/server.js:228
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED
at exports._errnoException (util.js:746:11)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1010:19)
npm ERR! Linux 3.2.0-67-virtual
npm ERR! argv "/home/vcap/app/vendor/node/bin/node" "/home/vcap/app/vendor/node/bin/npm" "start"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code ELIFECYCLE
npm ERR! nodetest@1.0.1 start: `node ./app.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nodetest@1.0.1 start script 'node ./app.js'.
npm ERR! This is most likely a problem with the nodetest package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./app.js
npm ERR! You can get their info via:
npm ERR! npm owner ls nodetest
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/vcap/app/npm-debug.log
6 回复
mongodb打开没
@zyvas 确认 mongodb
打开了
哥们你解决了么,我也遇到这个问题了,本地不报错,放到阿里云就报错了,阿里云win03的服务器
@sw-wang 我解决了 是coding.io 的开发人员给我解决的。https://coding.net/u/coding/p/Coding-Feedback/topic/49174?page=2
更改环境变量的位置,我的是因为环境变量位置不对导致mongodb 连不上。
@jaywcjlove hello,能详细解释下吗,原帖中的项目已经删除了~我也碰到了相同的问题,求大侠指教
@eksea 我的是process.env.VCAP_SERVICES
环境变量为空,往代码前面移动就好了…