4

I am trying to install spika backend (node applicaton) When I tried Start server in stand alone mode with the following command: $ node src/server/main.js

I encountered this error:

Error: Cannot find module 'socket.io-client/dist/socket.io.min.js'

Node version: v8.10.0 npm version: v3.5.2

1
  • What was the output of ‘npm install’ ? Try to rerun the command and put the output here. Commented Aug 18, 2018 at 8:55

2 Answers 2

2

Install socket.io and not socket.io-client

socket.io-client is the client side library, not server side. You have to link it in your HTML instead of including it in your node.js file. It is socket.io library actually that is to be included server side. Read more on How To Do here.

Sign up to request clarification or add additional context in comments.

2 Comments

I understand what you have mentioned. But I have used this reference for Spika Backened: https://github.com/cloverstudio/Spika/tree/master/web/src/server which uses socket.io-client too Moreover, I have tried to install socket.io manually but encountered this: > npm WARN optional Skipping failed optional dependency /chokidar/fsevents: > npm WARN notsup Not compatible with your operating system or architecture: [email protected] > npm WARN [email protected] No repository field. > npm WARN [email protected] No license field.
Its code is more than 2 years old. Nobody has updated it. I doubt you should continue working on projects like those.
1

Try running the following in the terminal at the directory of your package.json file:

npm i

npm i --save socket.io

  • npm i will install all the dependencies in your package.json file
  • If this dependency is not there you need to install it with npm i --save socket.io

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.