thomasdavis / backbonetutorials

As single page apps and large scale javascript applications become more prominent on the web, useful resources for those developers who are jumping the ship are crucial.
http://backbonetutorials.com
2.3k stars 1.7k forks source link

Nohm Error #137

Open kahunacohen opened 9 years ago

kahunacohen commented 9 years ago

Not sure if I'm missing something, but if I clone the project and try to run the server using node for the video tutorial, I get:

node server.js 
{ name: 'Nohm Error',
  message: 'Warning: setClient() received a redis client that is not connected yet. Consider waiting for an established connection before setting it.' }

events.js:72
        throw er; // Unhandled 'error' event
              ^
Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED
    at RedisClient.on_error (/net/iwebdev2/export/home/web/public/htdocs/staff/cohenaa/projects/video-backbone-beginner-server/node_modules/redis/index.js:189:24)
    at Socket.<anonymous> (/net/iwebdev2/export/home/web/public/htdocs/staff/cohenaa/projects/video-backbone-beginner-server/node_modules/redis/index.js:95:14)
    at Socket.EventEmitter.emit (events.js:95:17)
    at net.js:441:14
    at process._tickCallback (node.js:415:13)

I'd love to follow the tutorial without mocking up the responses. Any help is much appreciated! I did google this error and saw something on SO about calling setClient(redis), but it looks like that's already being done.

ghost commented 9 years ago

Hey not sure if you still want an answer to this but thought I'd leave a comment anyway. The 'Nohm Error' you're getting is actually just a warning, to resolve it you just need to wait until the redis client is connected before setting the client. This can be done by replacing 'nohm.setClient(redis);' with this: redis.on("connect", function() { nohm.setClient(redis); //Anything you do afterwards that relies on the nohm client }); This means that the client won't get set until after the redis client is connected.

As for your actual redis connection error, the issue there is that you're probably not actually running an instance of the redis server on your machine, or it's on a different port other than the default 6379. Make sure you have redis installed and a server running before running your server.js file.

Hope this helps. :)