Macil / browserify-hmr

Hot Module Replacement plugin for Browserify
MIT License
373 stars 26 forks source link

Problem with bufferutil and utf-8-validate #19

Closed rstacruz closed 8 years ago

rstacruz commented 8 years ago

Using browserify-hmr now gives you these errors:

Error: Cannot find module 'bufferutil' from 'xxx/node_modules/ws/lib' Error: Cannot find module 'utf-8-validate' from 'xxx/node_modules/ws/lib'

Because ws is now not compatible with browserify:

https://github.com/websockets/ws/commit/e54d45fbab3b19c2940e9057ce1e7b8f105873e0

This is a problem because browserify-hmr uses ws, which it assumes to be browserifyable (it was before!). As a workaround, you can install bufferutil and utf-8-validate, but it probably won't work completely (they rely on compiled extensions), and it will add 3.5MB of bloat on your package.

rstacruz commented 8 years ago

Also relevant:

https://github.com/websockets/ws/pull/661

rstacruz commented 8 years ago

This is how engine.io-client fixed it in their package: https://github.com/socketio/engine.io-client/pull/451/files

rstacruz commented 8 years ago

hmm, okay, it seems a socket.io-client fix was deployed just yesterday. If anyone else is running into this, you'll have to delete socket.io-client and npm install again.

Macil commented 8 years ago

Thanks for pointing out that a problem existed.

My response was going to be to see if pinning to an old version of socket.io-client worked until they fixed the issue themselves. Good to see they've done that now.

rstacruz commented 8 years ago

Aye, it really was a headache, pretty much busted every npm consumer of socket.io for a few days :\