npm install zmq fails during cf push

av V

Steps to reproduce:
1.) Create an empty folder.
2.) Add this package.json file.

"name": "zmq-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index.js"
"author": "",
"license": "",
"dependencies": {
"zmq": "2.8.0"
"engines": {
"node": "0.10.33"
3.) Add this index.js file.

var zmq = require('zmq');
var http = require('http');

http.createServer(function (req, res) {
res.writeHead(200, {'Content-Type': 'text/plain'});
for (var env in process.env) {
res.write(env + '=' + process.env[env] + '\n');
}).listen(process.env.PORT || 3000);
4.) Run npm install. That should build the library locally.
5.) Push the application to a CF

When the application starts, I get the below error
Prebuild detected (node_modules already exists)
Rebuilding any native modules
> zmq(a)2.8.0 install /tmp/staged/app/node_modules/zmq
> node-gyp rebuild
make: Entering directory `/tmp/staged/app/node_modules/zmq/build'
CXX(target) Release/
../ fatal error: zmq.h: No such file or directory
#include <zmq.h>
compilation terminated.
make: *** [Release/] Error 1
make: Leaving directory `/tmp/staged/app/node_modules/zmq/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/staged/app/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at ChildProcess.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Linux 3.19.0-49-generic
gyp ERR! command "node" "/tmp/staged/app/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /tmp/staged/app/node_modules/zmq
gyp ERR! node -v v0.10.33
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Linux 3.19.0-49-generic
npm ERR! argv "node" "/tmp/staged/app/.heroku/node/bin/npm" "rebuild"
npm ERR! node v0.10.33
npm ERR! npm v1.4.28
npm ERR! zmq(a)2.14.0 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the zmq(a)2.8.0 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the zmq package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs zmq
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls zmq
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /tmp/staged/app/npm-debug.log
-----> Build failed
We're sorry this build is failing! You can troubleshoot common issues here:
Some possible problems:
- node_modules checked into source control
Staging failed: Buildpack compilation step failed