question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot Resolve 'uws', Update README or "package.json"?

See original GitHub issue

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

You want to:

  • report a bug
  • request a feature

Current behaviour

I downloaded the example project webpack-build-server from socket.io’s master branch, run npm install to install the dependencies, and finally run npm run build to try to bundle the server, but webpack gives me the following errors:

ERROR in ./~/engine.io/lib/server.js
Module not found: Error: Can't resolve 'uws' in '/Users/ZehuaChen/Downloads/socket.io-master/examples/webpack-build-server/node_modules/engine.io/lib'
 @ ./~/engine.io/lib/server.js 107:27-41
 @ ./~/engine.io/lib/engine.io.js
 @ ./~/socket.io/lib/index.js
 @ ./lib/index.js

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

  1. Download socket.io’s master branch
  2. Go to examples/webpack-build-server;
  3. Run npm install;
  4. Run npm run build;

Note: the best way to get a quick answer is to provide a failing test case, by forking the following fiddle for example.

Expected behaviour

A server.js file should be produced in dist folder.

Setup

  • OS: macOS Hight SIerra
  • browser: Safari
  • socket.io version: 2.0.3

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

These are what’s printed in my terminal

> webpack-build-server@1.0.0 build /Users/ZehuaChen/Downloads/socket.io-master/examples/webpack-build-server
> webpack --config ./support/webpack.config.js

Hash: 997a1fd1ee0b1b064485
Version: webpack 2.7.0
Time: 468ms
    Asset    Size  Chunks                    Chunk Names
server.js  401 kB       0  [emitted]  [big]  main
   [0] ./~/debug/src/index.js 263 bytes {0} [built]
   [7] ./~/socket.io-parser/index.js 8.04 kB {0} [built]
  [16] ./~/engine.io/lib/socket.js 11.6 kB {0} [built]
  [17] ./~/engine.io/lib/transports/index.js 509 bytes {0} [built]
  [19] ./~/socket.io-parser/is-buffer.js 712 bytes {0} [built]
  [20] ./~/socket.io/lib/namespace.js 5.81 kB {0} [built]
  [31] ./~/socket.io/lib/index.js 12.9 kB {0} [built]
  [32] ./lib/index.js 474 bytes {0} [built]
  [43] ./~/engine.io/lib/engine.io.js 2.38 kB {0} [built]
  [44] ./~/engine.io/lib/server.js 15.1 kB {0} [built]
  [58] ./~/socket.io-adapter/index.js 5.44 kB {0} [built]
  [59] ./~/socket.io-client/package.json 3.19 kB {0} [built]
  [61] ./~/socket.io/lib 160 bytes {0} [built]
  [62] ./~/socket.io/lib/client.js 5.9 kB {0} [built]
  [63] ./~/socket.io/lib/parent-namespace.js 917 bytes {0} [built]
    + 59 hidden modules

WARNING in ./~/ws/lib/Validation.js
Module not found: Error: Can't resolve 'utf-8-validate' in '/Users/ZehuaChen/Downloads/socket.io-master/examples/webpack-build-server/node_modules/ws/lib'
 @ ./~/ws/lib/Validation.js 10:22-47
 @ ./~/ws/lib/Receiver.js
 @ ./~/ws/index.js
 @ ./~/engine.io/lib/server.js
 @ ./~/engine.io/lib/engine.io.js
 @ ./~/socket.io/lib/index.js
 @ ./lib/index.js

WARNING in ./~/ws/lib/BufferUtil.js
Module not found: Error: Can't resolve 'bufferutil' in '/Users/ZehuaChen/Downloads/socket.io-master/examples/webpack-build-server/node_modules/ws/lib'
 @ ./~/ws/lib/BufferUtil.js 35:21-42
 @ ./~/ws/lib/Receiver.js
 @ ./~/ws/index.js
 @ ./~/engine.io/lib/server.js
 @ ./~/engine.io/lib/engine.io.js
 @ ./~/socket.io/lib/index.js
 @ ./lib/index.js

WARNING in ./~/socket.io/lib/index.js
113:11-32 Critical dependency: the request of a dependency is an expression

ERROR in ./~/engine.io/lib/server.js
Module not found: Error: Can't resolve 'uws' in '/Users/ZehuaChen/Downloads/socket.io-master/examples/webpack-build-server/node_modules/engine.io/lib'
 @ ./~/engine.io/lib/server.js 107:27-41
 @ ./~/engine.io/lib/engine.io.js
 @ ./~/socket.io/lib/index.js
 @ ./lib/index.js

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! webpack-build-server@1.0.0 build: `webpack --config ./support/webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the webpack-build-server@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ZehuaChen/.npm/_logs/2018-05-17T21_30_47_624Z-debug.log

Update

I install uws package manually and it seems to work. Can someone update the README file or package.json since it’s really hard for a beginner like me to figure this out.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:11
  • Comments:20

github_iconTop GitHub Comments

46reactions
despagitocommented, Jun 21, 2018

It doesn’t stop you from npm start, just ignore the error.

8reactions
millspcommented, Jul 21, 2018

If you are compiling for node only, you should add the option then the error will disappear. You should add to your configuration file:

{
        ...
        target: 'node'
       ...
}

Otherwise, you are compiling for web only, then no option needs to be passed (default=‘web’) (or target=‘web’) but you should exclude ‘uws’ from being bundled, since it doesn’t work in the browser. In this case you should rather add:

{
        ...
        externals: {
            uws: "uws"
        },
       ...
}
Read more comments on GitHub >

github_iconTop Results From Across the Web

How to install a deprecated version of uws - Stack Overflow
I looked up the package and created a test folder to see if I could install the package you're talking about in there...
Read more >
uws - npm
It is time to upgrade to uWebSockets.js! Go to https://github.com/uNetworking/uWebSockets.js. Use of old "uws" releases is not recommended ...
Read more >
adi-ia / ia-angular2-seed-project - GitLab
Download source code ;.gitignore · First commit. 4 years ago ; README.md · Update README.md. 4 years ago ; angular.json · Updated deps....
Read more >
moleculer-web-uws - npm Package Health Analysis - Snyk
Learn more about moleculer-web-uws: package health score, popularity, security, ... For more information about how to use this package see README.
Read more >
deepstream.io - Yarn
Build Status npm version Coverage Status dependencies Status ... Display full readme ... Issue where headers were not retrieved correctly with new uws...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found