nodecellar icon indicating copy to clipboard operation
nodecellar copied to clipboard

socket.io.js 404, what am i missing?

Open adardesign opened this issue 12 years ago • 13 comments
trafficstars

I just cloned this repo, and ran it, i keep on getting a 404 for socket.io.js:

GET http://localhost:4000/socket.io/socket.io.js 404 (Not Found)

socket io

What am i doing wrong?

adardesign avatar Feb 10 '13 20:02 adardesign

did you run npm install first? package.json lists the dependencies of this app, and you should use npm to install them.

toddp avatar Feb 10 '13 20:02 toddp

@toddp, yes i did!

adardesign avatar Feb 10 '13 21:02 adardesign

hmm ok now I reproduce this. This may be related to new Express syntax:

http://stackoverflow.com/questions/10191048/socket-io-js-not-found

I've managed to eliminate the socket.io error with the following diff, but I still have other problems such as can not view list of wines.

diff --git a/server.js b/server.js
index f7005f3..ccc1f22 100644
--- a/server.js
+++ b/server.js
@@ -4,7 +4,8 @@ var express = require('express'),
     wine = require('./routes/wines');

 var app = express();
-
+var server = http.createServer(app);
+var io = require('socket.io').listen(server);
 app.configure(function () {
     app.set('port', process.env.PORT || 3000);
     app.use(express.logger('dev'));  /* 'default', 'short', 'tiny', 'dev' */
@@ -18,6 +19,6 @@ app.post('/wines', wine.addWine);
 app.put('/wines/:id', wine.updateWine);
 app.delete('/wines/:id', wine.deleteWine);

-http.createServer(app).listen(app.get('port'), function () {
+server.listen(app.get('port'), function () {
     console.log("Express server listening on port " + app.get('port'));
 });

toddp avatar Feb 10 '13 22:02 toddp

I Have the same problem, any updates?

mf2226 avatar Feb 11 '13 16:02 mf2226

I think the maintainer needs to look at this.

toddp avatar Feb 12 '13 16:02 toddp

I too can't see the list of wines... On Feb 12, 2013 4:12 PM, "Todd Pinkerton" [email protected] wrote:

I think the maintainer needs to look at this.

— Reply to this email directly or view it on GitHubhttps://github.com/ccoenraets/nodecellar/issues/7#issuecomment-13440029.

markopolo123 avatar Feb 12 '13 17:02 markopolo123

I can't see the list of wines too :(

noeliasfranco avatar Apr 05 '13 19:04 noeliasfranco

There is no data in collection wines, you need to call populateDB() once to insert records into it first

TonyLuo avatar Apr 17 '13 15:04 TonyLuo

For socket.io.js 404 issue, the socket.io client js is missing, you need to copy the /nodecellar/node_modules/socket.io/node_modules/socket.io-client/dist/socket.io.js into folder /nodecellar/public/socket.io/socket.io.js .

TonyLuo avatar Apr 17 '13 16:04 TonyLuo

@TonyLuo You don't need to copy socket.io.js if you run the node serverwithanalytics.js as socket.io will generate this endpoint (well, this works for me anywayz). Those of you who can't see list of wines...you may need to install mongodb...go here: http://docs.mongodb.org/manual/tutorial/install-mongodb-on-os-x/ (I use mac) and try the "Install from 10gen builds" unless you have Homebrew or MacPorts already installed. There are links to other OS at the top of that page.

webdogz avatar May 14 '13 17:05 webdogz

I had this problem. I can confirm that you have to install MongoDB in order to get it to work. You can follow instructions here:

http://docs.mongodb.org/manual/installation/

If you wish to run it locally, make sure to run a "mongod" (not mongo) before running "node server"

vu0tran avatar Jan 28 '14 03:01 vu0tran

KittPhi avatar Mar 26 '20 06:03 KittPhi

KittPhi Thanck you very mutch. I spent three days looking for a solution to the problem, and thanks to you I found it.

StarayYaga avatar Aug 21 '22 05:08 StarayYaga