Socket.io: Module not found: Can't resolve 'uws' in 'C:\....\node_modules\engine.io\lib

Created on 2 Oct 2018  ·  9Comments  ·  Source: socketio/socket.io

Note: for support questions, please use one of these channels: stackoverflow or slack

For bug reports and feature requests for the Swift client, please open an issue there.

For bug reports and feature requests for the Java client, please open an issue there.

You want to:

  • [x] report a bug
  • [ ] request a feature

Current behaviour

What is actually happening?
When ever I try to require socket io into any project and run it, I always get a module not found for UWS. If tried to manually install uws and ws but I get the same behavior.

Steps to reproduce (if the current behaviour is a bug)

npm install socket.io --save

add 'var io = require('socket.io')();' to app.js

npm run start

fails to build

Note: the best way (and by that we mean the only way) to get a quick answer is to provide a failing test case by forking the following fiddle.

Expected behaviour

What is expected?

Socket.io compiling

Setup

  • OS: Windows 10
  • browser: Chrome
  • socket.io version: 2.1.1

Other information (e.g. stacktraces, related issues, suggestions how to fix)

./node_modules/engine.io/lib/server.js
Module not found: Can't resolve 'uws' in 'C:UsersWalkerDesktopTestsockettestnode_modulesengine.iolib'

Most helpful comment

So I just had this same issue, but for a very different reason. Currently when I install the latest socket.io server package from npm uws will not be found.

This is happening because the publisher of uws has recently uploaded an empty package deleting all of the actual code D:

You can fix this by installing the last non destroyed release

yarn add [email protected]
npm install [email protected]

Link to empty / deprecated package: https://www.npmjs.com/package/uws

Insightful background info from reddit: https://www.reddit.com/r/node/comments/91kgte/uws_has_been_deprecated/

I'm going to post this in the top few results that come up when searching for this issue as it took me a while to figure out what was up and hopefully this will save someone out there some time!

All 9 comments

I believe this is happening because the uws package is in the devDependencies instead of dependencies in the package.json

i have de same problem, please help

I have the same problem too

i'm using linux lubuntu 16.04

i found an answer in https://stackoverflow.com/questions/52616766/socket-io-module-not-found-cant-resolve-uws-in-c-node-modules-engine

i used this and works

import openSocket from 'socket.io-client';

const socket = openSocket(myURL);

So I just had this same issue, but for a very different reason. Currently when I install the latest socket.io server package from npm uws will not be found.

This is happening because the publisher of uws has recently uploaded an empty package deleting all of the actual code D:

You can fix this by installing the last non destroyed release

yarn add [email protected]
npm install [email protected]

Link to empty / deprecated package: https://www.npmjs.com/package/uws

Insightful background info from reddit: https://www.reddit.com/r/node/comments/91kgte/uws_has_been_deprecated/

I'm going to post this in the top few results that come up when searching for this issue as it took me a while to figure out what was up and hopefully this will save someone out there some time!

@makhnnar seems to be my solution as well! And actually it is stated in the docs right near the top of the page.

import openSocket from 'socket.io-client';

const socket = openSocket(myURL);

Yes, I am facing exactly the same issue. But. I wanna use socket.io instead of client, Any thoughts? How to fix?

You can fix this by installing the last non destroyed release

yarn add [email protected]
npm install [email protected]

Was this page helpful?
0 / 5 - 0 ratings