Open jringo12 opened 7 years ago
What happens if you type in mongo
?
I can log in mongo shell while type mongo, but still got the same error when typing npm start.
/Users/yuyang/Documents/djan/lets-chat/node_modules/mongodb/lib/mongo_client.js:225
throw err
^
MongoError: failed to connect to server [localhost:27017] on first connect
at null.
npm ERR! Darwin 14.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "start"
npm ERR! node v5.1.0
npm ERR! npm v3.3.12
npm ERR! code ELIFECYCLE
npm ERR! lets-chat@0.4.7 start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lets-chat@0.4.7 start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lets-chat 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 lets-chat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! /Users/yuyang/Documents/djan/lets-chat/npm-debug.log
I am new to lets-chat and mongdb, any help would be appreciated, thanks in advance!
Here is what happens when I type in mongo.
$ mongo MongoDB shell version: 3.2.10 connecting to: test Server has startup warnings: 2016-11-11T10:28:06.099-0500 I CONTROL [initandlisten] * WARNING: You are running this process as the root user, which is not recommended. 2016-11-11T10:28:06.099-0500 I CONTROL [initandlisten] 2016-11-11T10:28:06.110-0500 I CONTROL [initandlisten] 2016-11-11T10:28:06.111-0500 I CONTROL [initandlisten] * WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2016-11-11T10:28:06.111-0500 I CONTROL [initandlisten] \ We suggest setting it to 'never' 2016-11-11T10:28:06.112-0500 I CONTROL [initandlisten]
Here is the debug log for lets-chat.
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/nodejs', '/usr/bin/npm', 'start' ]
2 info using npm@3.10.9
3 info using node@v7.1.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle lets-chat@0.4.7~prestart: lets-chat@0.4.7
6 silly lifecycle lets-chat@0.4.7~prestart: no script for prestart, continuing
7 info lifecycle lets-chat@0.4.7~start: lets-chat@0.4.7
8 verbose lifecycle lets-chat@0.4.7~start: unsafe-perm in lifecycle true
9 verbose lifecycle lets-chat@0.4.7~start: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/security/lets-chat/node_modules/.bin:/home/security/bin:/home/security/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle lets-chat@0.4.7~start: CWD: /home/security/lets-chat
11 silly lifecycle lets-chat@0.4.7~start: Args: [ '-c', 'node app.js' ]
12 silly lifecycle lets-chat@0.4.7~start: Returned: code: 1 signal: null
13 info lifecycle lets-chat@0.4.7~start: Failed to exec start script
14 verbose stack Error: lets-chat@0.4.7 start: node app.js
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.node app.js
22 error Exit status 1
23 error Failed at the lets-chat@0.4.7 start script 'node app.js'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the lets-chat package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error node app.js
23 error You can get information on how to open an issue for this project with:
23 error npm bugs lets-chat
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls lets-chat
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
@jringo12 does localhost
resolve to 127.0.0.1
? Try changing your mongo connection string in settings.yml
to mongodb://127.0.0.1/letschat
Yes localhost is resolving to 127.0.0.1.
I have changed the mongo connection string and that still did not work.
lets-chat@0.4.7 start /home/security/lets-chat node app.js
/home/security/lets-chat/node_modules/mongodb/lib/mongo_client.js:225
throw err
^
MongoError: failed to connect to server [127.0.0.1:27017] on first connect
at Pool.
npm ERR! Linux 4.8.0-27-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v7.1.0
npm ERR! npm v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! lets-chat@0.4.7 start: node app.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lets-chat@0.4.7 start script 'node app.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the lets-chat 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 information on how to open an issue for this project with:
npm ERR! npm bugs lets-chat
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls lets-chat
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request: npm ERR! /home/security/lets-chat/npm-debug.log
mongo --verbose
$ mongo --verbose MongoDB shell version: 3.2.10 connecting to: test 2016-11-18T10:44:22.253-0500 D NETWORK [thread1] creating new connection to:127.0.0.1:27017 2016-11-18T10:44:22.264-0500 D COMMAND [ConnectBG] BackgroundJob starting: ConnectBG 2016-11-18T10:44:22.265-0500 D NETWORK [thread1] connected to server 127.0.0.1:27017 (127.0.0.1) 2016-11-18T10:44:22.278-0500 D NETWORK [thread1] connected connection! Server has startup warnings: 2016-11-17T08:53:11.457-0500 I CONTROL [initandlisten] * WARNING: You are running this process as the root user, which is not recommended. 2016-11-17T08:53:11.458-0500 I CONTROL [initandlisten] 2016-11-17T08:53:11.459-0500 I CONTROL [initandlisten] 2016-11-17T08:53:11.459-0500 I CONTROL [initandlisten] * WARNING: /sys/kernel/mm/transparent_hugepage/enabled is 'always'. 2016-11-17T08:53:11.459-0500 I CONTROL [initandlisten] \ We suggest setting it to 'never' 2016-11-17T08:53:11.459-0500 I CONTROL [initandlisten]
@jringo12 dang, that looks just fine. I have no idea what's wrong!
Was hoping your issue was like @youyou0988s (localhost wouldn't resolve)
Did you install mongo via package manager?
yeah everything was installed through apt-get
Enter PEM pass phrase:
/home/security/lets-chat/node_modules/connect-mongo/node_modules/mongodb/lib/mongo_client.js:225 throw err ^ MongoError: failed to connect to server [localhost:27017] on first connect at null. (/home/security/lets-chat/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at EventEmitter.emit (events.js:95:17)
at null. (/home/security/lets-chat/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/pool.js:271:12)
at g (events.js:180:16)
at EventEmitter.emit (events.js:98:17)
at Socket. (/home/security/lets-chat/node_modules/connect-mongo/node_modules/mongodb/node_modules/mongodb-core/lib/connection/connection.js:175:10)
at Socket.g (events.js:180:16)
at Socket.EventEmitter.emit (events.js:92:17)
at Socket._onTimeout (net.js:327:8)
at Timer.unrefTimeout [as ontimeout] (timers.js:412:13)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
I made sure MongoDB is running. mclc:~/lets-chat$ service mongodb status mongodb start/running, process 13169
Any thoughts?