We help IT Professionals succeed at work.
Get Started

NodeJS Paths to Socket.IO Issue

Last Modified: 2015-03-05
New to NodeJS, having trouble with path description to modules, both server and client side. I'm Node and Linux challenged.

Both server.js and index.html resides at "/opt/mydir/www/workingDirectory/"
socket.io resides at "/usr/lib/node_modules/socket.io"
socket.io.js resides at "/usr/lib/node_modules/socket.io/node_modules/socket.io-client/socket.io.js"

so in server.js :  var socketio = require('./usr/lib/node_modules/socket.io');    (not sure is this is correct??)
index.html: <script type="text/javascript" src="./usr/lib/node_modules/socket.io/node_modules/socket.io-client/socket.io.js"></script>
the path in index.html must be wrong, I'm getting a js error in Firefox console:
"Reference error: io is not defined
var iosocket = io.connect();

any assistance would be appreciated
Watch Question
Fixer of Problems
Most Valuable Expert 2014
This problem has been solved!
Unlock 1 Answer and 2 Comments.
See Answer
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE