Pergunta

Trying to setup a simple node app hosted on openshift - using the restify and mongojs modules. 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.

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

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?

Nenhuma solução correta

Outras dicas

On Openshift, you cannot should not install stuff globally.

Use instead local module, and if you need to run executables (like coffee, mocha, grunt...), launch them from the node_modules\.bin folder.

--- 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

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top