Skip to content Skip to sidebar Skip to footer

Cannot Find Module 'socket.io' After Global Install

I try to use socket io so I follow they tutorial in here. I did: var app = require('express')(); And I get this error: Error: Cannot find module 'express' Before running I did

Solution 1:

You do not need to install express or socket.io globally.

The error is the result of Node being unable to find the express module in your local npm registry; the package.json file. You need to create a package.json file in the root of your project.

Navigate to the root of the directory and run:

npm init

The command npm init creates the package.json file. Any subsequent installs with the --save option will install the module and register it in the package.json.


Post a Comment for "Cannot Find Module 'socket.io' After Global Install"