2

Hi i am trying to run the nodejs script and it pops up the following error message:

enter image description here

I have installed socket.io globally using following command:

>npm install -g socket.io

but still no luck.

Any help?

Princess
  • 103
  • 1
  • 2
  • 10
  • Don't install it globally. Only install modules globally which you'll be using command line interfaces of, like mocha or casper. Anything you "`require`" in your app is installed locally. – laggingreflex Oct 23 '14 at 05:41
  • i installed it locally first but it is not working either thats why i installed globally later – Princess Oct 23 '14 at 05:48
  • In your app folder there's a "node_modules" directory, does "socket.io" exists in it? – laggingreflex Oct 23 '14 at 05:50
  • I can't think of any reason it shouldn't be working in that case :/. Try deleting the folder, clearing npm cache (`npm cache clean`) and installing it again. Also, are the other modules working fine? – laggingreflex Oct 23 '14 at 06:01
  • Show us the `require()` line you use to load it. – jfriend00 Oct 23 '14 at 06:27
  • https://stackoverflow.com/questions/17058298/error-cannot-find-module-socket-io – isomorphismes Oct 26 '17 at 19:01

1 Answers1

5

Use it locally instead, and save to your package.json

npm install socket.io --save
Andi N. Dirgantara
  • 2,050
  • 13
  • 20