Note: for support questions, please use one of these channels: stackoverflow or slack
I built a simple task list with this and was able to get it to work a few months ago. I am going back to build another more robust program, but am getting this error when I try to run webpack 1.13.1:
ERROR in ./socket-listeners/task-listener.js
Module not found: Error: Cannot resolve module 'socket.io-client' in /home/ubuntu/workspace/socket-listeners
@ ./socket-listeners/task-listener.js 33:9-36
I have used both "import io from 'socket.io-client';" and "const io = require('socket.io-client');" and both reproduce the same error.
I was expecting it to find the module on its own. I am able to find it manually in my node_modules folder.
I'm hoping this can be fixed relatively quickly as this is going to be a final project so I can graduate. If anybody has any work-around, please let me know. Thanks!
How did you install the package? Could you share your webpack config?
The package.json nor bower.json are configured properly
@killerspaz would you know what can be improved / fixed?
Thanks, @killerspaz. That's what did the trick, just had to dig a little deeper into the socket.io module:
import io from 'socket.io/node_modules/socket.io-client';
@darrachequesne sorry, my feedback was actually meant for socket.io-client, not this project. Must have gotten switched up somehow. Upon further inspection, it looks like bower.json is missing, and written as .bower.json, but with invalid data? I'm not fully understanding what's going on there, since bower says it's grabbing from https://github.com/LearnBoost/socket.io-client.git, which my URL is redirecting to https://github.com/socketio/socket.io-client.git; but the source certainly doesn't appear to have this file. Apparently bower adds it. Utilizing debowerify fails somewhere along the line saying it can't find socket.io-client. I ended up referencing socket.io-client/dist/socket.io for it to resolve properly.
@jstrother, you can use just socket.io-client to reduce packages if you wanted. It's not really optimal or suggested to dig into a module's dependencies.
As with @killerspaz I needed to reference socket.io-client/dist/socket.io
Thanks, @killerspaz, that worked. (Sorry for being late responding)
error: Error: Unable to resolve module use-socket.io-client from App.js: use-socket.io-client could not be found within the project.
Most helpful comment
As with @killerspaz I needed to reference
socket.io-client/dist/socket.io