Been using Openshift / Node.Js for a while now, mostly problem free. Usually I install (via npm) modules to my local (windows) machine, develop, than git-deploy to Openshift and all goes well.
I recently added the jsdom module (which again works fine locally), but when I git-deploy (no errors on the git push), I get this error when I try to use my app:
.../app-root/runtime/repo/node_modules/jsdom/node_modules/contextify/node_modules/bindings/bindings.js:91
throw err
^
Error: Could not locate the bindings file.
Followed by a list of directories Node attempted to look for it. When I check the remote server for these directories, they are missing (even though they exist on my local machine and were pushed). If I attempt to copy the folders over via ftp, I get this error:
Invalid ELF header
Which I understand is because the contextify module did not build on the server (ie, I copied it over).
Note that my dependencies in my package.json contain "jsdom":"0.1.7".
After some googling, I next tried to manually install the module on the remote server via npm. This produced the following error:
npm http 304 https://registry.npmjs.org/mime
npm http 304 https://registry.npmjs.org/combined-stream
npm http 304 https://registry.npmjs.org/async
> contextify@0.1.7 install /var/lib/openshift/52...52/nodejs/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
npm http GET https://registry.npmjs.org/assert-plus/0.1.2
npm http GET https://registry.npmjs.org/asn1/0.1.11
npm http GET https://registry.npmjs.org/ctype/0.5.2
npm http 304 https://registry.npmjs.org/ctype/0.5.2
npm http 304 https://registry.npmjs.org/assert-plus/0.1.2
npm http 304 https://registry.npmjs.org/asn1/0.1.11
Traceback (most recent call last):
File "/opt/rh/nodejs010/root/usr/bin/gyp", line 15, in <module>
import gyp
ImportError: No module named gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/opt/rh/nodejs010/root/usr/lib/node_modules/node-gyp/lib/configure.js:417:16)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:784:12)
gyp ERR! System Linux 2.6.32-431.el6oso.bz844450.x86_64
gyp ERR! command "node" "/opt/rh/nodejs010/root/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /var/lib/openshift/52...52/app-root/runtime/dependencies/nodejs/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.5
gyp ERR! node-gyp -v v0.9.5
gyp ERR! not ok
This is where I'm now stuck. It would seem the remote server is missing "gyp", and I have no idea how to solve that. I have the "node-gyp" module installed, and I have read about other npm/openshift issues here, but don't know how to apply them to my problem.
Any help would be greatly appreciated. Thanks in advance!