SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Member
    Join Date
    Dec 2006
    Location
    Toronto, Canada
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Can't get localhost:3000 and "Welcome to Express"

    after typing "node app" in command line, I got following:


    Express server listening on port 3000 in development mode

    /Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/lib/utils.js:413
    throw err;
    ^
    Error: Uncaught, unspecified 'error' event.
    at NativeConnection.EventEmitter.emit (events.js:73:15)
    at Model.init (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/lib/model.js:554:31)
    at exports.tick (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/lib/utils.js:408:16)
    at Db.ensureIndex (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1066:28)
    at Db.indexInformation (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/db.js:1200:28)
    at Cursor.toArray (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:124:30)
    at Cursor.each (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:166:32)
    at Cursor.nextObject.self.queryRun (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:441:39)
    at Cursor.close (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:687:5)
    at Cursor.nextObject.commandHandler (/Library/WebServer/Documents/node.js/book/chapter01/authentication/node_modules/mongoose/node_modules/mongodb/lib/mongodb/cursor.js:441:21)

    Please help!

  2. #2
    SitePoint Member
    Join Date
    Dec 2006
    Location
    Toronto, Canada
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Solved. I configured db.js file and put the right versions according to package.json file.

    It would be nice to have more detailed instructions in the book about setting up the environment.

  3. #3
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I'm having a similar problem... When I go to type node app, I get the following error.

    Tylers-MacBook-Air:authentication tylerh$ node app

    /Users/tylerh/authentication/app.js:35
    .log("Express server listening on port %d in %s mode", app.address().port, app
    ^
    TypeError: Cannot read property 'port' of null
    at Object.<anonymous> (/Users/tylerh/authentication/app.js:35:76)
    at Module._compile (module.js:449:26)
    at Object.Module._extensions..js (module.js:467:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.runMain (module.js:492:10)
    at process.startup.processNextTick.process._tickCallback (node.js:244:9)

    Does anyone have suggestions for how to troubleshoot this?

  4. #4
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay... not sure where the mix up happened, but was excited to figure it out.

    I found I finally got to the point where I was receiving another error, that commenting on the actually app.js file not working. Googling the error got me to this page: http://stackoverflow.com/questions/1...o-method-flash

    So I added connect-flash to node.

    However localhost:3000 still doesn't come up with anything.

    But now if I visit http://0.0.0.0:3000 instead, it shows the "Express Hello World" message.

  5. #5
    SitePoint Author
    Join Date
    Nov 2012
    Posts
    48
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    TylerH, if you are getting the welcome message it would seem to be some sort of DNS configuration issue and nothing to do with the Node.js side

  6. #6
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hi Don, thanks for responding.

    Not really sure what the issue is, I've been scouring stackoverflow for people having similar problems but not having much luck. I kept moving on and got to the form submission part, which I don't know that problem is causing the error now but the signup form submits now (http://0.0.0.0:3000/form) but just cycles through until it eventually times out without giving a real error.

    I'll post the solution when I find it.
    Last edited by TylerH; Jan 5, 2013 at 12:11. Reason: Was unclear about my position in the book in the first edit

  7. #7
    SitePoint Author
    Join Date
    Nov 2012
    Posts
    48
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    What about http://127.0.0.1 does that work?

  8. #8
    SitePoint Member
    Join Date
    Jan 2013
    Posts
    4
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Okay, kind of an obscure issue but I figured it out. The form now posts using the 0.0.0... address as well as the 127.0.0.1 the actual problem though wasn't any of that.

    I compared my files with someone else who had a working example, and found that they had a simple alphanumeric password. I was using an '@' symbol in my password. So I dumbed down my mongo database username and password to just being test/test... (Super secure) but yeah now it connects.

    So the lesson here was not to include the @ symbol in your passwords?

    Hope that help someone else, I know I lost three days from just that.

    Thanks again Don for offering advice!
    Last edited by TylerH; Jan 6, 2013 at 12:51. Reason: missing word in one of my senctences


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •