简体   繁体   English

Openshift(node.js)无法安装jsdom

[英]Openshift (node.js) fails to install jsdom

Been using Openshift / Node.Js for a while now, mostly problem free. 已经使用Openshift / Node.Js一段时间了,大部分都没有问题。 Usually I install (via npm) modules to my local (windows) machine, develop, than git-deploy to Openshift and all goes well. 通常我安装(通过npm)模块到我的本地(windows)机器,开发,而不是git-deploy到Openshift,一切顺利。

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: 我最近添加了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.

Followed by a list of directories Node attempted to look for it. 接下来是Node尝试查找的目录列表。 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: 如果我尝试通过ftp复制文件夹,我收到此错误:

Invalid ELF header 无效的ELF标头

Which I understand is because the contextify module did not build on the server (ie, I copied it over). 我理解的是因为contextify模块没有在服务器上构建(即,我复制了它)。

Note that my dependencies in my package.json contain "jsdom":"0.1.7". 请注意,我的package.json中的依赖项包含“jsdom”:“0.1.7”。

After some googling, I next tried to manually install the module on the remote server via npm. 经过一些谷歌搜索,我接下来尝试通过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. 看起来远程服务器缺少“gyp”,我不知道如何解决这个问题。 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. 我安装了“node-gyp”模块,我在这里阅读了其他npm / openshift问题 ,但不知道如何将它们应用到我的问题中。

Any help would be greatly appreciated. 任何帮助将不胜感激。 Thanks in advance! 提前致谢!

Per John Peat in question comments, and Ben Parees comment 4 at the bugzilla issue he linked, it seems that the OpenShift Node.js 0.10 cartridge is missing a path to GYP in its shell path variables. Per Per Peat在问题评论中,Ben Parees在他链接的bugzilla问题上评论4,似乎OpenShift Node.js 0.10盒式磁带在其shell路径变量中缺少GYP的路径。

Your set of cartridges may not be providing GYP dependencies. 您的一组墨盒可能无法提供GYP依赖性。 Python may not be available at all. Python可能根本不可用。 I just confirmed there is no PYTHONPATH environment variable in their Node.Js cartridge, and the system isn't set up to do nmp as user from commandline. 我刚刚确认他们的Node.Js盒式磁带中没有PYTHONPATH环境变量,并且系统没有设置为从命令行执行nmp作为用户。

Try declaring jsdom in packages.json, per Redhat docs. 根据Redhat文档尝试在packages.json中声明jsdom

If that fails, or you need a more personal setup, like providing your own Python, then the answer may be to build a cartridge. 如果失败了,或者您需要更个性化的设置,比如提供自己的Python,那么答案可能是构建一个盒式磁带。 That would also be an opportunity to move up to Node 0.12 or Io.js. 这也是一个向上移动到节点0.12或Io.js的机会。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM