ReferenceError: io is not defined

535 views
Skip to first unread message

Philippe Rathe

unread,
Nov 25, 2010, 11:03:54 AM11/25/10
to Socket.IO
I'm having a hard time adding Socket.IO as a submodule and using
require.

git submodule add https://github.com/LearnBoost/Socket.IO.git vendor/
Socket.IO --recursive *
git submodule update --init --recursive

*Note that on the README page of Socket.IO "git clone" was used
instead of "git submodule add". Cloning it was not adding it as a
submodule for me. The --recursive option on "git submodule add" didn't
fetch the submodules but the "git submodule update --init --recursive"
does.

Then I want to require it in my server:

var io = require('./vendor/Socket.IO/socket.io');

ReferenceError: io is not defined
at /Users/prat/src/chess/ChessGlue/website/chessglue.com/vendor/
Socket.IO/socket.io.js:39:2
at Object.<anonymous> (/Users/prat/src/chess/ChessGlue/website/
chessglue.com/vendor/Socket.IO/socket.io.js:86:2)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)
at Module.loadSync (node.js:338:12)
at loadModule (node.js:283:14)
at require (node.js:411:14)
at Object.<anonymous> (/Users/prat/src/chess/ChessGlue/website/
chessglue.com/app.js:14:10)
at Module._compile (node.js:462:23)
at Module._loadScriptSync (node.js:469:10)

What would the require line be?

Guillermo Rauch

unread,
Nov 25, 2010, 12:17:40 PM11/25/10
to sock...@googlegroups.com
Try io = require('./vendor/Socket.IO/socket.io/lib/socket.io')
--
Guillermo Rauch
http://devthought.com

Philippe Rathe

unread,
Nov 25, 2010, 2:53:29 PM11/25/10
to sock...@googlegroups.com
No, that path does not exists. I have the same structure in vendor/ as in the git project.

$ ls -1 Socket.IO/
Makefile
README.md
bin
lib
socket.io.js

$ ls -1 Socket.IO/lib/
data.js
io.js
socket.js
transport.js
transports
util.js
vendor

Do I have to include a single file or a directory?
Can you point me to the path to require in the Gihub repository?
Thanks

-- Philippe



Philippe Rathe

unread,
Nov 25, 2010, 3:02:55 PM11/25/10
to sock...@googlegroups.com
Sorry, I was pointing the the Socket.IO project instead of the Socket.IO-node project on my server.
Closed.

-- Philippe




On 25-Nov-10, at 12:17 PM, Guillermo Rauch wrote:

Reply all
Reply to author
Forward
0 new messages