New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot Resolve 'uws', Update README or "package.json"? #3249
Comments
I am also getting the same warnings:
|
Did you manage to solve it? Have the same issue.. |
Nope. It's only a warning so there's no effect other than ugly console output, but it's still there. |
It doesn't stop you from |
If you are compiling for node only, you should add the option then the error will disappear.
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.
|
@pirix-gh This doesn't seem to be the issue. From my config:
|
@ianpaschal Ok, then maybe you are importing a project into another ? Project_1
Project_2
Webpack: Compile Project_2 And this may happen because the dependency is looked up in Project_2 but Project_1 is holding it. By doing this I am able to reproduce the errors you provided above |
Thanks for explaining why it went wrong, and providing an alternate approach! |
@Zehua-Chen Pleasure, hope it fixed your problem. I know how annoying it can be to publish all the time so... For this case of split projects, you can use during your development:
or depending on your version
It will resolve the dependencies properly & run, but remember it is not suitable for production. |
I did a lot of research now and still did not understand the issue and how to solve it. ERROR in ./node_modules/engine.io/lib/server.js
Module not found: Error: Can't resolve 'uws' in 'xxxxxxxx/node_modules/engine.io/lib'
@ ./node_modules/engine.io/lib/server.js 107:27-41
@ ./node_modules/engine.io/lib/engine.io.js
@ ./node_modules/socket.io/lib/index.js package.json "dependencies": {
"express": "^4.16.3",
"socket.io": "^2.1.1"
},
"devDependencies": {
"tslint": "^5.11.0",
"typescript": "2.9.2",
"uglifyjs-webpack-plugin": "^1.2.7",
"webpack": "^4.16.4",
"webpack-cli": "^3.1.0"
}, webpack.config.js
|
@btxtiger it's because you must not bundle your dependencies when working with node (will be installed with package.json). It's the default behaviour for webpack, because it bundles your project for the web. Add this to your conf, it will exclude your dependencies by reading your package.json
This way you will get (almost) a publishable package |
@pirix-gh Thanks! Okay, that makes sense. I was hoping being able to create a full bundle that just needs to be pushed to the server without need to install/update modules via package.json. I'm still not sure if this really is not possible, except for that error with socket.io it seems to work. |
@btxtiger You can do that locally. Just do not publish it on NPM as it breaks the dependency rules. If you still want to do this, try to exclude uws:
|
@pirix-gh Great, thanks very much for explaination. I moved to an optimized package.json which excludes all dev dependencies while building with webpack, and always runs npm install before starting. Seems to be the best solution for now. |
I didn't have time to debug it fully, but when upgrading from
So keeping Karma at |
I'm getting this issue whenever I import or require socket.io. I've tried manually installing uws and Node still can't resolve uws. |
I am getting this issue as well, I am not clear on how to solve it. |
Webpack / front-end folks, if you just need SocketIO in your client-side app to connect to some WebSocket server, you can just use this: https://github.com/socketio/socket.io-client Solved my |
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 uws@10.148.1 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! |
For me, |
Note: for support questions, please use one of these channels: stackoverflow or slack
You want to:
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 runnpm run build
to try to bundle the server, but webpack gives me the following errors:Steps to reproduce (if the current behaviour is a bug)
examples/webpack-build-server
;npm install
;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
Other information (e.g. stacktraces, related issues, suggestions how to fix)
These are what's printed in my terminal
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.The text was updated successfully, but these errors were encountered: