Skip to content

Error: Cannot find module 'bufferutil' during browserify #103

Open

Description

@carn1x

npm list:

├─┬ angular-websocket@2.0.1
│ └─┬ ws@1.1.1
│   ├── options@0.0.6
│   └── ultron@1.0.2

App.js

(function() {
  var angular_websocket;

  angular_websocket = require('angular-websocket');

}).call(this);

Command browserify app.js -o bundle.js gives:

Error: Cannot find module 'bufferutil' from '/www/node_modules/angular-websocket/node_modules/ws/lib'
    at /usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:46:17
    at process (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:173:43)
    at ondir (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:188:17)
    at load (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:69:43)
    at onex (/usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:92:31)
    at /usr/lib/node_modules/browserify/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

Activity

  1. carn1x commented on Oct 10, 2016

    @carn1x
    Author

    Fixed with npm install bufferutil utf-8-validate, and I suspect this issue is probably not within the scope of angular-websockets to fix. Should these actually be dependencies of ws or does it make sense for these to be dependencies of this project directly?

  2. Remco75 commented on Nov 18, 2016

    @Remco75

    nope, I think this is somewhere within this module: webpack doesnt work as well.
    some code has changed so it tries to load to much it seems :-(

  3. chaddjohnson commented on Feb 28, 2017

    @chaddjohnson

    I vote for bufferutil and utf-8-validate being added as dependencies of angular-websocket. Is there a reason the author didn't do this?

  4. Ocramius commented on Apr 19, 2017

    @Ocramius

    This was handled in fdfea1f

  5. odedniv commented on Jul 30, 2017

    @odedniv

    Don't you need this in production? (was added to devDependencies)

  6. danielpiedra commented on Sep 4, 2017

    @danielpiedra

    any insights here? i believe @odedniv is right..

  7. krobing commented on Sep 6, 2017

    @krobing

    I've not needed to install those dependencies, because anyway when I running the node.js server, it throw an error in socket.io, so what I've done is exclude those dependencies bufferutil and utf-8-validate when run browserify on the terminal or as statement so this way -u bufferutil -u utf-8-validate.

  8. belfz commented on Sep 7, 2017

    @belfz

    I'm facing similar problem (with webpack):

    WARNING in ./~/ws/lib/Validation.js
    Module not found: Error: Cannot resolve module 'utf-8-validate' in /Users/marcin/projects/front-end/node_modules/ws/lib
     @ ./~/ws/lib/Validation.js 12:16-41
    
    WARNING in ./~/ws/lib/BufferUtil.js
    Module not found: Error: Cannot resolve module 'bufferutil' in /Users/marcin/projects/front-end/node_modules/ws/lib
     @ ./~/ws/lib/BufferUtil.js 12:15-36
    
    ERROR in ./~/ws/lib/WebSocketServer.js
    Module not found: Error: Cannot resolve module 'tls' in /Users/marcin/projects/front-end/node_modules/ws/lib
     @ ./~/ws/lib/WebSocketServer.js 15:10-24
    
    ERROR in ./~/options/lib/options.js
    Module not found: Error: Cannot resolve module 'fs' in /Users/marcin/projects/front-end/node_modules/options/lib
     @ ./~/options/lib/options.js 6:9-22
    
  9. joeyrobert commented on Oct 12, 2017

    @joeyrobert

    Drive by comment, I came across this same error when including ws in the client side. It's actually not needed on the client side and browsers should use the native WebSocket constructor. See this issue for more information: websockets/ws#423

  10. jacek-jaskolski commented on Nov 8, 2017

    @jacek-jaskolski

    If your client is in browser you can use my fork to resolve this issue.
    npm i jacek-jaskolski/angular-websocket --save

  11. Araevin commented on Mar 6, 2025

    @Araevin

    If your client is in browser you can use my fork to resolve this issue. npm i jacek-jaskolski/angular-websocket --save

    This seems to have been deleted. I needed it for an old project. In case anyone is here looking for it, I have it up at 'Araevin/angular-websocket'.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions