Setting up rocket.chat in Mac OSX Sierra

The other day i was trying to setup (https://rocket.chat)[Rocket Chat] a chat engine wrote in Node JS that can be hosted locally. I did this primarily to setup a chat functionality for the project i was working on, and after considering a lot of options (PubNub, FireChat) i decided to go with this one. Because it allows self hosting and is based on node JS and Django. But this has specific constraints on setting up. For example you need Node v8.9.4 (though it appear to run with other systems and newer ones). When i run

npm install

i get the following error

sharp@0.19.0 install /Users/dakshins/tools/rocket.chat/programs/server/npm/node_modules/sharp
node-gyp rebuild

sharp: 'linux-x64' binaries cannot be used on the 'darwin-x64' platform. Please remove the 'node_modules/sharp/vendor' directory and run 'npm install'.
gyp: Call to 'node -e "require('./binding').download_vips()"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: gyp failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:336:16)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Darwin 16.7.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/dakshins/tools/rocket.chat/programs/server/npm/node_modules/sharp
gyp ERR! node -v v8.9.4
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp@0.19.0 install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp@0.19.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dakshins/.npm/_logs/2018-03-30T17_51_35_294Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! meteor-dev-bundle@ install: node npm-rebuild.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the meteor-dev-bundle@ install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/dakshins/.npm/_logs/2018-03-30T17_51_35_347Z-debug.log

To fix it all you have to do is install vips with graphicsmagick.

brew install homebrew/science/vips --with-webp --with-graphicsmagick

The reason is beacuse the default native binaries build with the node module gyp doesn't seem to have correct references to darwin-x64 binaries, and install it explicitly makes gyp refer the appropriate ones. Let me continue my luck on rocket.chat.

soundararajan