socket.io icon indicating copy to clipboard operation
socket.io copied to clipboard

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

Open walkerreynolds16 opened this issue 8 years ago • 10 comments

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:\Users\Walker\Desktop\Test\sockettest\node_modules\engine.io\lib'

walkerreynolds16 avatar Oct 02 '18 21:10 walkerreynolds16

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

kfarst avatar Oct 16 '18 20:10 kfarst

i have de same problem, please help

mhpm avatar Nov 15 '18 21:11 mhpm

I have the same problem too

makhnnar avatar Nov 24 '18 14:11 makhnnar

i'm using linux lubuntu 16.04

makhnnar avatar Nov 24 '18 14:11 makhnnar

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);

makhnnar avatar Nov 24 '18 15:11 makhnnar

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!

codymikol avatar Jan 03 '19 04:01 codymikol

@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);

kjr247 avatar Apr 17 '19 21:04 kjr247

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

Femina avatar Dec 08 '19 05:12 Femina

You can fix this by installing the last non destroyed release

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

vishalj20 avatar Feb 27 '20 09:02 vishalj20

For future readers:

ws was reverted as the default wsEngine in [email protected], as there was a lot of stability issues with "uws".

Documentation: https://socket.io/docs/v3/server-installation/

darrachequesne avatar Feb 23 '21 12:02 darrachequesne