2

I am creating a nodejs chat application, and I am in the process of setting up the environment. My OS is Ubuntu 14.04. I could understand that I need nodejs and socket.io to be installed on my PC before creating the application.

How can I install these packages: nodejs and socket.io on my system, so that I can start building my chat application?

muru
  • 197,895
  • 55
  • 485
  • 740

1 Answers1

4

socket.io has a chat rooms feature. For more information see this answer to the question nodejs and socket.io chat rooms at Stack Overflow.

To install nodejs and socket.io from the terminal type:

sudo apt-get install nodejs
sudo apt-get install npm
sudo npm install socket.io

Update: In Ubuntu 14.04 and later the node snap package is more up-to-date and npm is bundled with it.

In order to test if socket.io is working, try this tutorial: Get Started: Chat application. If you get an error message when following the tutorial that says: TypeError: path must be absolute or specify root to res.sendFile then replace sendFile with sendfile (all lowercase), and of course you should also use the command nodejs to start Node.js in interactive mode in Ubuntu instead of node.

socket.io - node.js realtime framework server

karel
  • 114,770