简体   繁体   English

尝试获取openshift / nodejs上已安装模块的列表时出错

[英]Errors on trying to get a list of installed modules on openshift/nodejs

Trying to setup a simple node app hosted on openshift - using the restify and mongojs modules. 尝试设置一个使用openshift托管的简单节点应用程序-使用restify和mongojs模块。 The only change I have made to the app is adding 我对应用程序所做的唯一更改是添加

"restify": "latest",
"mongojs": "latest"

to the dependencies section in the package.json, followed by a git push. 到package.json中的dependencies部分,然后进行git push。

Since I want to setup a local dev/testing environment as well, am using the documentation provided at http://openshift.github.io/documentation/oo_cartridge_guide.html#local-development-testing 由于我也想设置本地开发/测试环境,因此请使用http://openshift.github.io/documentation/oo_cartridge_guide.html#local-development-testing提供的文档

as described in the docs - if I run 如文档中所述-如果我运行

ssh <uid>@<appname>.rhcloud.com npm list -g

I get a long list of errors ending with 我得到一长串以结尾的错误

npm WARN unmet dependency /opt/rh/nodejs010/root/usr/lib/node_modules/ws requires options@'latest' but will load 
npm WARN unmet dependency /opt/rh/nodejs010/root/usr/lib/node_modules/options, 
npm WARN unmet dependency which is version 0.0.5 
npm ERR! missing: npm@*, required by undefined@undefined 
npm ERR! missing: openshift-node-web-proxy@*, required by undefined@undefined 
npm ERR! invalid: options@0.0.5 /opt/rh/nodejs010/root/usr/lib/node_modules/options 
npm ERR! not ok code 0

The error body contains a lot of errors like ... 错误正文包含很多错误,例如...

glob error { [Error: EACCES, readdir '/opt/rh/nodejs010/root/usr/lib/node_modules/npm/man/man3/whoami.3']
  errno: 3,
  code: 'EACCES',
  path: '/opt/rh/nodejs010/root/usr/lib/node_modules/npm/man/man3/whoami.3' }
glob error { [Error: EACCES, readdir '/opt/rh/nodejs010/root/usr/lib/node_modules/npm/man/man3/whoami.3']
  errno: 3,
  code: 'EACCES',
  path: '/opt/rh/nodejs010/root/usr/lib/node_modules/npm/man/man3/whoami.3' }

What is the recommended course of action? 建议采取的措施是什么? How to fix these errors? 如何解决这些错误? Is the application in a broken state? 应用程序是否处于损坏状态?

On Openshift, you cannot should not install stuff globally. 在Openshift上,您不能不全局安装内容。

Use instead local module, and if you need to run executables (like coffee, mocha, grunt...), launch them from the node_modules\\.bin folder. 改用本地模块,如果需要运行可执行文件(例如coffee,mocha,grunt ...),请从node_modules\\.bin文件夹中启动它们。

--- EDIT --- -编辑-

As said in the official documentation , it's possible to install stuff globally, but it's not recommended. 官方文档中所述,可以在全局范围内安装内容,但不建议这样做。 I guess you should have sufficient right. 我想你应该有足够的权利。

the better alternative though is to install them in the home directory of the currently logged user on your local machine/workstation. 不过,更好的选择是将它们安装在本地计算机/工作站上当前登录用户的主目录中。

If you really need stuff on global, consider putting them into your cartdrige: it will be more handy when scalling on different VMs 如果您确实需要全局上的东西,请考虑将它们放进购物车:在不同的VM上扩展时,它将更加方便

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

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