Cannot resolve module 'socket.io-client' in feathers-chat-example/client/src/services
Closed this issue · 5 comments
Hi Niall - First, thanks for this excellent feathersjs + vuejs example!
I'm a relative newbie to both libraries as well as to socketio, es6, and webpack/babel6 :) so I apologize in advance if I've missed something simple that caused the error.
I cloned the project and installed client and server side dependencies without an obvious problem. And starting the server showed no problem.
Then I ran npm run dev' on the client side and got the
Cannot resolve module 'socket.io-client'` error. I tried to search this down, best I could, as follows:
In client/src/service/index.js
looks like this line import io from 'socket.io-client'
is causing the error (but I'm not certain).
So, I looked for socket.io-client
, and found it in client\node_modules\feathers-socketio\node_modules\ socket.io\node_modules\socket.io-client
.
So, I'm at a loss to understand why the socket.io-client
reference in client/src/service/index.js
doesn't resolve.
Any assistance would be greatly appreciated!
I'm running on a Mac OS 10.9.5, node v.4.4.3, npm v.2.15.1. Here's the full error
npm run dev
> feathers-chat@ dev /Users/EF/Feathers/feathers-chat-example/client
> node build/dev-server.js
Listening at http://localhost:8080
webpack: wait until bundle finished: /index.html
webpack built 8129495782af01eff8d3 in 116991ms
Hash: 8129495782af01eff8d3
Version: webpack 1.13.0
Time: 116991ms
Asset Size Chunks Chunk Names
app.js 2.69 MB 0 app
ERROR in ./src/services/index.js
Module not found: Error: Cannot resolve module 'socket.io-client' in /Users/ElliotFielstein/Feathers/feathers-chat-example/client/src/services
@ ./src/services/index.js 16:14-41
Child html-webpack-plugin for "index.html":
Asset Size Chunks Chunk Names
index.html 21.6 kB 0
webpack: bundle is now VALID.
Hi, I'm mobile at the moment, but could you try remove your node_modules
folder with rm -rf node_modules
and then reinstall your dependencies with npm install
?
Thanks
I've resolved the issue and will push an update shortly.
To fix, run npm i socket.io-client --save-dev
. Please confirm if this has resolved your issue, thanks.
Also, it's worth noting that I contributed a slightly more advanced Vue.js example to the official Feathers examples repo, and I shall be submitting a PR to the Feathers docs over the coming days. https://github.com/feathersjs/feathers-chat
Thanks Niall, installing socket.io-client on the client side worked! Glad not to have to move to node v.5 -- tried it before and it broke another project.
I see you've pushed the package.json update adding the socket.io-client dependency. Thanks!