2014-10-10 9 views
13

T Hanks im Voraus für jede Hilfe, die ich bekommen kann.NPM installieren für Pakete nicht funktioniert

Ich versuche Pakete wie grunt, bower und yeoman mit nodejs und dem NPM in meinem Mac OSX 10.8 Terminal zu installieren.

Ich überprüfe Knoten und NPM-Versionen, um zu bestätigen, dass sie korrekt installiert sind und dass das wahr ist. Allerdings, wenn ich beginne, einen Befehl auszuführen, ein Paket wie Bower zu installieren, nach der Verwendung:

npm install -g bower 

ich verschiedene Mengen von Fehlern kommen zu bekommen. Ich versuche, den sudo-Befehl zu vermeiden. Ich habe versucht, sudo zu verwenden, aber danach bekam ich eine Antwort "Befehl nicht gefunden." Ich habe das Gefühl, dass die Pakete nicht in den richtigen Ordnern oder Verzeichnissen liegen, aber ich weiß nicht, was ich als nächstes tun soll.

Zu Ihrer Information das sind die Fehler, die ich erhalten:

npm ERR! Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig' 
npm ERR! { [Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig'] 
npm ERR! errno: 3, 
npm ERR! code: 'EACCES', 
npm ERR! path: '/Users/myname/.node/lib/node_modules/bower/.editorconfig' } 
npm ERR! 
npm ERR! Please try running this command again as root/Administrator. 

npm ERR! System Darwin 12.5.0 
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "bower" 
npm ERR! cwd /Users/myname 
npm ERR! node -v v0.10.32 
npm ERR! npm -v 1.4.28 
npm ERR! path /Users/myname/.node/lib/node_modules/bower/.editorconfig 
npm ERR! code EACCES 
npm ERR! errno 3 
npm ERR! stack Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig' 
npm ERR! error rolling back Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower /.editorconfig' 
npm ERR! error rolling back { [Error: EACCES, unlink '/Users/myname/.node/lib/node_modules/bower/.editorconfig'] 
npm ERR! error rolling back errno: 3, 
npm ERR! error rolling back code: 'EACCES', 
npm ERR! error rolling back path: '/Users/myname/.node/lib/node_modules/bower/.editorconfig' } 
npm ERR! not ok code 0 

Für Privatsphäre, ich meinen eigenen Namen mit dem Proxy-myname in die Wege ersetzt. Außerdem besteht dieses Problem weiterhin, wenn ich versuche, grunt und yeoman zu installieren.

Bei weiterer Inspektion bemerkte ich, dass ich zwei Ordner habe. Einer namens "Benutzer" und ein Name "usr." Innerhalb von 'Benutzern' sehe ich einen Ordner namens 'node_modules'. In 'usr/local/lib/node_modules/npm/node_modules' habe ich jedoch festgestellt, dass es keine Bower-, Grunt- oder Yeoman-Dateien gibt. Dies ist nur Spekulation, aber sind die Dateien nicht ordnungsgemäß in die notwendigen Ordner installiert, damit sie in npm ausgeführt werden können?

Jede Hilfe oder Eingabe wäre sehr willkommen!

UPDATE 10/10/14

Als Referenz der Menschen habe ich den Befehl sudo versucht, um zu sehen, ob es funktionieren würde, und es zeigt die folgende:

/Users/myname/.node/bin/bower -> /Users/myname/.node/lib/node_modules/bower/bin/bower 
    [email protected] /Users/myname/.node/lib/node_modules/bower 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected], strip- [email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
    ├── [email protected] 
    ├── [email protected] ([email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected], [email protected], [email protected]) 
    ├── [email protected] (figu[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 
    ├── [email protected] ([email protected], [email protected]) 
    └── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]) 

==== ======================== Allerdings ist das obige keine richtige Lösung. Wenn ich versuche, eine Überprüfung durchzuführen, um zu sehen, ob die Laube installiert ist, indem ich zum Beispiel bower -v oder bower -version oder irgendeinen anderen bower-Befehl eintippe, bekomme ich "command not found". Was ist los?

UPDATE 10/11/14

Also nichts, was ich versucht habe, so hat sich weit gegeben mir die Fähigkeit zum Ausführen des Befehls 'npm installieren -g Bower.' Aus Neugier, wie ich bereits erwähnt habe, habe ich die 'sudo npm install -g bower Befehl' ausgeführt, die schien, Bower zu installieren. Wenn Sie jedoch Befehle eingeben, wird der Befehl nicht gefunden. Beim Versuch, sudo bower Befehle zu führen, wird 'command not found' ebenfalls angezeigt. Was ich nicht verstehe ist, dass, wenn ich den Befehl 'npm ls' ausführen, um zu sehen, was der NPM installiert hat, habe ich interessanterweise eine Liste der folgenden installierten Pakete. Sie müssen die Liste nicht lesen, da sie lang ist, aber achten Sie darauf, wie das erste Element aussieht. Wenn das stimmt, und es bedeutet, dass Bower tatsächlich von Npm installiert wurde, warum funktionieren deshalb Bower-Befehle nicht?

/Users/myname. 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └─┬ [email protected] 
    │ │  └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├─┬ [email protected] 
    │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ └── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├─┬ [email protected] 
    │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ └── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├─┬ [email protected] 
    │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ └── [email protected] 
    │ │ │ │ ├─┬ [email protected] 
    │ │ │ │ │ ├─┬ [email protected] 
    │ │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ │ └── [email protected] 
    │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ └── [email protected] 
    │ │ │ │ └─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └─┬ [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ ├── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ ├─┬ [email protected] 
    │ │ │ │ │ ├── [email protected] 
    │ │ │ │ │ └── [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ ├─┬ [email protected] 
    │ │ │ │ └── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │  └─┬ [email protected] 
    │ │ │  ├─┬ [email protected] 
    │ │ │  │ └── [email protected] 
    │ │ │  ├── [email protected] 
    │ │ │  ├── [email protected] 
    │ │ │  ├─┬ [email protected] 
    │ │ │  │ └── [email protected] 
    │ │ │  └── [email protected] 
    │ │ ├── [email protected] 
    │ │ └─┬ [email protected] 
    │ │ └─┬ [email protected] 
    │ │  └── [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ └── [email protected] 
    ├─┬ [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├─┬ [email protected] 
    │ │ │ ├── [email protected] 
    │ │ │ └── [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├─┬ [email protected] 
    │ │ ├── [email protected] 
    │ │ └── [email protected] 
    │ ├─┬ [email protected] 
    │ │ └── [email protected] 
    │ ├── [email protected] 
    │ ├── [email protected] 
    │ └── [email protected] 
    └─┬ [email protected] 
     ├─┬ [email protected] 
     │ ├── [email protected] 
     │ ├── [email protected] 
     │ ├─┬ [email protected] 
     │ │ ├── [email protected] 
     │ │ └── [email protected] 
     │ └── [email protected] 
     └─┬ [email protected] 
     ├─┬ [email protected] 
     │ ├── [email protected] 
     │ └── [email protected] 
     ├─┬ [email protected] 
     │ ├── [email protected] 
     │ └─┬ [email protected] 
     │ ├── [email protected] 
     │ └── [email protected] 
     ├── [email protected] 
     └─┬ [email protected] 
      ├─┬ [email protected] 
      │ ├── [email protected] 
      │ ├── [email protected] 
      │ ├── [email protected] 
      │ └── [email protected] 
      └─┬ [email protected] 
      └── [email protected] 
+0

Wie haben Sie Knoten installiert? – srquinn

+0

Ich ging auf die Website von Nodejs. Das universelle Paket für Mac mit dem Knoten v0.10.32pkg wurde heruntergeladen. Nach den Anweisungen aus dem Paket habe ich die Berechtigungen freigegeben, um die Installation des Knotens zu ermöglichen, da meine Sicherheit den Entwickler nicht erkannt hat. Dann fuhr ich fort, den Knoten gemäß der ausführbaren Datei innerhalb des Pakets zu installieren. Ich habe den Bedingungen zugestimmt, sie dann an dem Standardort installiert, den das Installationsprogramm bereits beschrieben hat, und dann beendet, sobald der Knoten und npm installiert wurde. – user2793755

+0

Am Ende bekomme ich die folgende Zusammenfassung ‚Knoten bei /usr/local/bin/Knoten npm installiert wurde bei /usr/local/bin/npm Vergewissern Sie sich, dass/usr/local/bin installiert wurde ist in Ihrem $ PATH. – user2793755

Antwort

4

Führen Sie den globalen (-g) installiert als admin.

> sudo npm install -g bower 

Sie haben diesen Fehler -

npm ERR! Please try running this command again as root/Administrator. 

***** BELOW UPDATE *****

Überprüfen Sie, ob es installiert ist, und erhalten die Version

> bower -v 

Sie können die Laube jetzt nicht sehen, da sie als Administrator installiert wurde. Versuchen Sie, die Versionsnummer durch Ausführen

> sudo bower -v 

Sie sollten jetzt die Versionsnummer sehen.

nimmt das Paket mit chown

> cd /Users/<username>/.npm 
> chown <username> bower* 

Ich nehme persönlich Eigentum an alles im/Users/Verzeichnis. Es ist Ihr Verzeichnis und nicht global.

> chown <username> * 

***** UPDATE 2 unten *****

Es sieht aus wie es jetzt ein PATH Problem. Haben Sie das NPM-Verzeichnis in der PATH sehen, wenn Sie

> echo $PATH 

Typ I verwenden MacPorts so npm und Knoten im Verzeichnis/opt/local/bin und/opt/local/sbin installieren. Ich habe eine kurze Überprüfung im Netz durchgeführt und es sieht so aus, als müssten Sie die folgende/usr/local/bin haben, wenn Sie das Paket von der Knoten-Site installiert haben.

Check out this article about installing node (particularly the part about the PATH.

Das Link verweist auch this article on how to modify your PATH.

Hoffnung, das hilft.

+0

Ich habe gelesen, dass die Verwendung des Befehls sudo nicht empfohlen wird. Darüber hinaus, obwohl ich diese Methode versuche, um zu sehen, ob es funktioniert, bekomme ich etwas, das aussieht wie das installierte Bower-Paket. Wenn ich jedoch einfache Bower-Befehle wie bower -v oder bower -version eintippe, bekomme ich "-bash: bower: command not found". – user2793755

+0

Ich habe gerade meine Antwort aktualisiert. Es gibt keine Möglichkeit, Sudo zu verwenden, um global zu installieren. Es macht Sinn, weil Sie etwas überall installieren ... nur der Administrator sollte das können. Die Übernahme des eigenen Benutzerverzeichnisses ist vollkommen sicher. – VtoCorleone

+0

Ah ich sehe. Wie auch immer, ich habe versucht Sudo Bower-V und immer noch Bower Befehl nicht gefunden. – user2793755

1

Ich hatte ein ähnliches Problem mit meinem Mac. Ich habe das Folgende getan, um das Problem zu lösen.

  1. offen 'Disk Utility' Anwendung
  2. Ihrer Festplatte auswählen.
  3. Lauf Berechtigungen überprüfen Platten
  4. Lauf Reparatur der Zugriffsrechte
+0

Stört es Sie zu erklären, was das konkret macht? Ich werde es versuchen und über meine Fortschritte berichten. – user2793755

+0

Habe gerade diese Methode ausprobiert, und trotz allem bekomme ich immer noch die ursprünglich erwähnten Fehler. – user2793755

+0

Normalerweise, wenn ich diesen Fehler bekomme, war es mit dem Berechtigungsproblem mit dem Ordner verbunden, in dem npm versucht, das Paket zu installieren. Wenn das Problem dadurch nicht behoben wurde, können Sie versuchen, chown rekursiv im Ordner /Users/myname/.node auszuführen. – ywplee

6

Dies löste das Problem für mich:

sudo chown -R `whoami` ~/.node/lib/node_modules/bower/ 
npm install -g bower 
bower -v 
1.3.12 

Sie sollten nicht laufen müssen npm als sudo zu installieren.

+0

Danke. Ich habe das verwendet, um es auf einem Ubuntu 14 arbeiten zu lassen –

5

Das ist für mich gearbeitet:

ich meine Benutzerberechtigungen grundsätzlich in das Verzeichnis direkt nach diesem erwähnt gab ->stack Error: EACCES, unlink..., in Ihrem Fall wäre es so etwas wie sudo chown -R USERNAME /Users/myname/ sein.

Für Leute, die neu sind, vergessen Sie nicht, USERNAME im obigen Befehl mit Ihren eigenen zu ändern, wenn Sie Ihren Benutzernamen nicht kennen, führen Sie einfach whoami, um es zu bekommen.

Danach können Sie jedes Paket installieren ohne die Notwendigkeit, sudo, npm install -g SomePackage zu verwenden.

3

Ich hatte ähnliche Probleme beim Versuch, Bower über NPM zu installieren.

Ich bin kein Experte in diesem aber war sicher, dass es mit $ PATH verbunden war und 2 Artikel gefunden, die in Kombination dies für mich perfekt behoben.

Der erste Kern von Dan Haerbert ist: https://gist.github.com/DanHerbert/9520689

Dan sagt

„Wenn Sie einen Mac Homebrew-Nutzer sind und Sie installierten Knoten über Homebrew ist es eine große philosophische Frage mit . „

: die Art und Weise Homebrew und NPM zusammenarbeiten Wenn Sie Knoten mit Homebrew installieren und dann versuchen npm Update npm -g zu tun, werden Sie einen Fehler wie diese sehen

Der Fehler, den er zeigt, ist dem ursprünglichen Fehler sehr ähnlich.

Seine Lösung ist mit dem Knoten neu zu installieren, aber sicher zu stellen, dass NPM nicht über Homebrew installiert, da, wie er sagt:

npm sein eigener Paket-Manager ist, und es ist daher besser npm haben Verwalten Sie sich selbst und seine Pakete statt Homebrew tun es. Wenn Sie die Homebrew-Version von npm verwenden, benötigen Sie außerdem sudo , um globale Pakete zu installieren. Das ist auch eine sehr schlechte Idee.

Er sagt Knoten zu deinstallieren und dann mit den folgenden Befehlen neu installieren:

brew install node --without-npm 
echo prefix=~/.node >> ~/.npmrc 
curl -L https://www.npmjs.org/install.sh | sh 

Und dann mit

export PATH="$HOME/.node/bin:$PATH" 

Dieser arbeitete für mich zu beenden und fixiert alle meine Probleme. Ich konnte 'npm install -g bower' ausführen, ohne die Fehlermeldung zu erhalten.

Schließlich, bevor ich die obigen Schritte machte, wollte ich sicherstellen, dass ich den Knoten & npm vollständig deinstalliert hatte.Um dies zu erreichen, habe ich die folgenden Schritte aus Stackoverflow Frage gefolgt 11177954, speziell aus der Antwort von Dominic Tancredi, der sagt:

rekapitulieren, die beste Art und Weise (ich habe gefunden) vollständig deinstallieren Knoten + npm ist folgendes zu tun:

  1. gehen nach/usr/local/lib und einen beliebigen Knoten löschen und node_modules
  2. zu/go usr/local/include und einen beliebigen Knoten löschen und node_modules Verzeichnis
  3. wenn Sie installiert mit brew install node, dann rennen b rew Deinstallations Knoten in Terminal
  4. überprüfen Ihr Home-Verzeichnis für alle lokalen oder lib oder schließen Ordner und löschen Sie alle Knoten oder node_modules von dort
  5. nach/usr/local/bin gehen und einen beliebigen Knoten ausführbar löschen Unter Umständen müssen Sie zu tun, um die zusätzliche Anweisungen auch:
sudo rm /usr/local/bin/npm 
sudo rm /usr/local/share/man/man1/node.1 
sudo rm /usr/local/lib/dtrace/node.d 
sudo rm -rf ~/.npm 
sudo rm -rf ~/.node-gyp 
sudo rm /opt/local/bin/node 
sudo rm /opt/local/include/node 
sudo rm -rf /opt/local/lib/node_modules 

ich hoffe, das ist eine Hilfe für jemand :-)

0

müssen Sie chmod und chan ge die Dateiberechtigung für alle Dateien in /Users//.config/configstore/

sollte danach gut funktionieren. Mac-Benutzer müssen möglicherweise unter Verwendung von su zu root wechseln, was sie in den Systemeinstellungen aktivieren müssen, bevor sie den Befehl chmod ausführen.