Reputation: 670
ERROR in ./~/socket.io-client/bin/builder.js
Module not found: Error: Can't resolve 'fs' in 'E:\work\brickman2\node_modules\socket.io-client\bin'
@ ./~/socket.io-client/bin/builder.js 11:9-22
@ ./~/socket.io-client/lib/io.js
@ ./src/services/pusher.ts
@ multi main
ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Can't resolve 'fs' in 'E:\work\brickman2\node_modules\xmlhttprequest\lib'
@ ./~/xmlhttprequest/lib/XMLHttpRequest.js 16:9-22
@ ./~/socket.io-client/lib/util.js
@ ./~/socket.io-client/lib/io.js
@ ./src/services/pusher.ts
@ multi main
ERROR in ./~/xmlhttprequest/lib/XMLHttpRequest.js
Module not found: Error: Can't resolve 'child_process' in 'E:\work\brickman2\node_modules\xmlhttprequest\lib'
@ ./~/xmlhttprequest/lib/XMLHttpRequest.js 15:12-36
@ ./~/socket.io-client/lib/util.js
@ ./~/socket.io-client/lib/io.js
@ ./src/services/pusher.ts
@ multi main
I'm searched with google and github issus, but no one work for me.
[email protected] is a old version, But can not to update it. because the socket.io version in server is 0.9.7 and can not change. if I update the client will not connet the server.
Upvotes: 2
Views: 618
Reputation: 51
I faced the same issue and have found the next solution-replacing requiring socket-io.client for bundled version of it.
ES5 version
//var io = require('socket.io-client');
var io = require('socket.io-client/dist/socket.io.js'); //worked solution
ES6 version
//import io from 'socket.io-client';
import io from 'socket.io-client/dist/socket.io.js'; //worked solution
Upvotes: 5