Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error starting Lets-Chat #722

Open
jringo12 opened this issue Nov 11, 2016 · 11 comments
Open

Error starting Lets-Chat #722

jringo12 opened this issue Nov 11, 2016 · 11 comments

Comments

@jringo12
Copy link

lets-chat@0.4.7 start /home/security/lets-chat
node app.js

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?

@hhaidar
Copy link
Member

hhaidar commented Nov 11, 2016

What happens if you type in mongo?

@youyou0988
Copy link

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. (/Users/yuyang/Documents/djan/lets-chat/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:77:13)
at emit (events.js:169:7)
at null. (/Users/yuyang/Documents/djan/lets-chat/node_modules/mongodb-core/lib/connection/pool.js:271:12)
at g (events.js:260:16)
at emitTwo (events.js:87:13)
at emit (events.js:172:7)
at Socket. (/Users/yuyang/Documents/djan/lets-chat/node_modules/mongodb-core/lib/connection/connection.js:165:49)
at Socket.g (events.js:260:16)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at doNTCallback2 (node.js:452:9)
at process._tickCallback (node.js:366:17)

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

@youyou0988
Copy link

I am new to lets-chat and mongdb, any help would be appreciated, thanks in advance!

@jringo12
Copy link
Author

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]

@jringo12
Copy link
Author

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.7prestart: 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.7start: 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.7start: 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.7start: 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. (/usr/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/lib/utils/spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:885:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid lets-chat@0.4.7
16 verbose cwd /home/security/lets-chat
17 error Linux 4.8.0-27-generic
18 error argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
19 error node v7.1.0
20 error npm v3.10.9
21 error code ELIFECYCLE
22 error lets-chat@0.4.7 start: 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 ]

@hhaidar
Copy link
Member

hhaidar commented Nov 18, 2016

@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

@jringo12
Copy link
Author

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. (/home/security/lets-chat/node_modules/mongodb-core/lib/topologies/server.js:313:35)
at emitOne (events.js:96:13)
at Pool.emit (events.js:188:7)
at Connection. (/home/security/lets-chat/node_modules/mongodb-core/lib/connection/pool.js:271:12)
at Connection.g (events.js:292:16)
at emitTwo (events.js:106:13)
at Connection.emit (events.js:191:7)
at Socket. (/home/security/lets-chat/node_modules/mongodb-core/lib/connection/connection.js:175:10)
at Socket.g (events.js:292:16)
at emitNone (events.js:86:13)
at Socket.emit (events.js:185:7)
at Socket._onTimeout (net.js:342:8)
at ontimeout (timers.js:365:14)
at tryOnTimeout (timers.js:237:5)
at Timer.listOnTimeout (timers.js:207:5)

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

@hhaidar
Copy link
Member

hhaidar commented Nov 18, 2016

mongo --verbose

@jringo12
Copy link
Author

$ 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]

@hhaidar
Copy link
Member

hhaidar commented Nov 18, 2016

@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?

@jringo12
Copy link
Author

yeah everything was installed through apt-get

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants