2016-11-09 11 views
0
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 

私はGoogleとgithub issusで検索されていますが、誰も私のために働いていません。[email protected] with typescript and webpack2インポートエラー

[email protected]は古いバージョンですが、更新できません。サーバーのsocket.ioバージョンが0.9.7で変更できないためです。私がクライアントを更新する場合、サーバーを接続しません。

答えて

3

私は同じ問題に直面し、次の解決策を見つけました。代わりに、バンドルされたバージョンのsocket-io.clientが必要です。

ES5バージョン

//var io = require('socket.io-client'); 
var io = require('socket.io-client/dist/socket.io.js'); //worked solution 

ES6バージョン

//import io from 'socket.io-client'; 
import io from 'socket.io-client/dist/socket.io.js'; //worked solution 
+0

ライフセーバー!広告された通りの作品 – Patrick

関連する問題