2014-10-30 32 views
11

Ich versuche, Npm arbeiten auf OpenShift. Wenn ich versuche, ein Paket zu installieren npm install mit:Kann nicht installiert werden mit npm, weil Berechtigungen in openshift

$npm install bower 
npm ERR! Error: EACCES, mkdir '/var/lib/openshift/5425aaa04******0094/.npm' 
npm ERR! { [Error: EACCES, mkdir '/var/lib/openshift/5425aaa04******0094/.npm'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/var/lib/openshift/5425aaa04******0094/.npm' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Linux 2.6.32-431.29.2.el6.x86_64 
npm ERR! command "node" "/usr/bin/npm" "install" "bower" 
npm ERR! cwd /var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies 
npm ERR! node -v v0.6.20 
npm ERR! npm -v 1.1.37 
npm ERR! path /var/lib/openshift/5425aaa04******0094/.npm 
npm ERR! code EACCES 
npm ERR! message EACCES, mkdir '/var/lib/openshift/5425aaa04******0094/.npm' 
npm ERR! errno 3 
npm ERR! 3 errno 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies/npm-debug.log 
npm ERR! not ok code undefined 
npm ERR! not ok code 3 

Das ist, weil ich in meinem Home-Verzeichnis (/var/lib/openshift/5425aaa04******0094/)

Dies ist, wie npm Config sieht aus wie nicht über die Berechtigungen schreiben:

So
$npm config list 
; cli configs 

; node install prefix = undefined 
; node bin location = /usr/bin/node 
; cwd = /var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies 
; HOME = /var/lib/openshift/5425aaa04******0094/ 
; 'npm config ls -l' to show all defaults. 

ich habe versucht, das Präfix Einstellung zu setzen:

$npm config set prefix /var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies/ 
npm ERR! Error: EACCES, open '/var/lib/openshift/5425aaa04******0094/.npmrc' 
npm ERR! { [Error: EACCES, open '/var/lib/openshift/5425aaa04******0094/.npmrc'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/var/lib/openshift/5425aaa04******0094/.npmrc' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Linux 2.6.32-431.29.2.el6.x86_64 
npm ERR! command "node" "/usr/bin/npm" "config" "set" "prefix" "/var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies/" 
npm ERR! cwd /var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies 
npm ERR! node -v v0.6.20 
npm ERR! npm -v 1.1.37 
npm ERR! path /var/lib/openshift/5425aaa04******0094/.npmrc 
npm ERR! code EACCES 
npm ERR! message EACCES, open '/var/lib/openshift/5425aaa04******0094/.npmrc' 
npm ERR! errno 3 
npm ERR! 3 errno 
npm ERR! 
npm ERR! Additional logging details can be found in: 
npm ERR!  /var/lib/openshift/5425aaa04******0094/app-root/runtime/dependencies/npm-debug.log 
npm ERR! not ok code undefined 
npm ERR! not ok code 3 

Da ich in meinem Home-Verzeichnis keine Schreibberechtigung habe und npm versucht, die Datei ~/.npmrc zu bearbeiten, kann ich die Einstellungen nicht ändern.

Irgendwelche Ideen, wie kann ich das beheben? Alles, was ich tun möchte, ist in der Lage, Bower zu installieren.

Danke!

EDIT: Ich habe sudo Berechtigungen nicht in Openshift

+0

genau habe ich gleiche Problem, ich bin die ganze Plattform und ich Setup jenkins auf kostenlosen Account zu bewerten. und ja, dann ist die Installation lokaler NPM-Pakete unmöglich !!! ein anderes Problem ist, dass die Version meines Knotens 0.6.x ist, die sehr alt ist! und ich kann es nicht aktualisieren (oder ich habe die Lösung nicht gefunden, wie es geht). – kamiseq

+0

Sie haben keine Schreibrechte in Ihrem Home-Verzeichnis? –

+0

Alle Antworten nein? –

Antwort

11

Try this:

OLDHOME=$HOME 
HOME=`pwd` 
npm install package 
HOME=$OLDHOME 

Dieser kleine Trick funktioniert für mich.

+0

Wo stellst du das hin? – leontalbot

2

dies funktionierte für mich

cd nodejs/ 

npm install package 
+0

Das hat wirklich funktioniert! Es ist dumm von mir, dass ich nicht darüber nachgedacht habe. – Zaxter

Verwandte Themen