I'm trying to use browserify to bundle my server side code into a single JS file. Hence I'm running
browserify --node -t coffeeify source/server.js.coffee -o deployment/server.js
But I'm getting the following error
Error: Cannot find module '../build/Release/bufferutil' from '/My/Project/Path/node_modules/socket.io/node_modules/engine.io/node_modules/ws/lib'
The only offending line seems to be the require "socket.io"
. When I remove it the bundling works fine. It also works fine if I remove the --node
flag.
The "missing" module appears to be there when I check the directory with
ls node_modules/socket.io/node_modules/engine.io/node_modules/ws/build/Release/
I see
.deps/ bufferutil.node* linker.lock obj.target/ validation.node*
Some googling led me to this https://github.com/websockets/ws/issues/25. But that seems to be referring to an old version of ws
. The version of ws
in the module is already beyond that and I've also already tried rebuilding node from source as recommended but to no avail.
Any idea what could still be causing this error?
I run into the same problem and I have error first with bufferutil
then with utf-8-validate
, but according to this Readme.md, you need to install them as requirements with --save
options. Hope this helps.
There are 2 optional modules that can be installed along side with the ws module. These modules are binary addons which improve certain operations, but as they are binary addons they require compilation which can fail if no c++ compiler is installed on the host system.
npm install --save bufferutil
: Improves internal buffer operations which allows for faster processing of masked WebSocket frames and general buffer operations.
npm install --save utf-8-validate
: The specification requires validation of invalid UTF-8 chars, some of these validations could not be done in JavaScript hence the need for a binary addon. In most cases you will already be validating the input that you receive for security purposes leading to double validation. But if you want to be 100% spec-conforming and have fast validation of UTF-8 then this module is a must.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With