【发布时间】:2014-05-31 08:55:25
【问题描述】:
使用 Openshift / Node.Js 已经有一段时间了,基本上没有问题。通常我会(通过 npm)将模块安装到我的本地(Windows)机器上,然后进行开发,然后将 git-deploy 安装到 Openshift 上,一切顺利。
我最近添加了 jsdom 模块(在本地也可以正常工作),但是当我 git-deploy (在 git push 上没有错误)时,当我尝试使用我的应用程序时出现此错误:
.../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.
后面是 Node 试图查找的目录列表。当我在远程服务器上检查这些目录时,它们丢失了(即使它们存在于我的本地计算机上并被推送)。如果我尝试通过 ftp 复制文件夹,我会收到此错误:
无效的 ELF 标头
我的理解是因为 contextify 模块没有在服务器上构建(即,我复制了它)。
请注意,我的 package.json 中的依赖项包含“jsdom”:“0.1.7”。
经过一番谷歌搜索后,我接下来尝试通过 npm 在远程服务器上手动安装该模块。这产生了以下错误:
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
这就是我现在卡住的地方。远程服务器似乎缺少“gyp”,我不知道如何解决。我安装了“node-gyp”模块,并且我已经阅读了其他npm/openshift issues here,但不知道如何将它们应用于我的问题。
任何帮助将不胜感激。提前致谢!
【问题讨论】:
-
我也有同样的问题。任何线索或仍然卡住? /:
-
我也遇到了这个问题。
-
随着时间的推移,我们中的更多人会遇到这种情况...bugzilla.redhat.com/show_bug.cgi?id=1103113 我认为这是他们的 bugzilla 中的错误 - 但显然没有人愿意修复它?有一些 hacky 的解决方法,但这违背了 PAAS 的意义?注意:它在 Heroku 上运行正常...
-
我遇到了类似的问题。尝试重命名 node_modules 并使用 npm install 重新安装。