Karma-Befehl nicht gefunden, wenn Karma bereits installiert ist

Ich habe node.js verwendet, um Karma zu installieren. Mein erster Versuch ist fehlgeschlagen, als ich den folgenden Befehl auf dem Terminal ausgeführt habe:

npm install -g karma

Das schlug fehl, also entschied ich mich für:

sudo npm install -g karma

Nach der Eingabe meines Passworts schien es richtig zu installieren. Ich füge einen Teil der Ausgabe der Installation ein. Vielleicht bedeutet dies etwas für jemanden und ist für meine Frage relevant. Nach all den npm http-Nachrichten sehe ich Folgendes:

> [email protected] install /usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)

  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/bufferutil.node
  SOLINK_MODULE(target) Release/bufferutil.node: Finished
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/validation.node
  SOLINK_MODULE(target) Release/validation.node: Finished
/usr/local/share/npm/bin/karma -> /usr/local/share/npm/lib/node_modules/karma/bin/karma
[email protected] /usr/local/share/npm/lib/node_modules/karma
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])

Wenn ich dann versuche, den folgenden Befehl auszuführen, um mit diesem Befehl eine Karma-Konfigurationsdatei zu erstellen:

karma init karma.config.js

Dies ist die Nachricht, die zurückgegeben wird:

-bash: karma: command not found

Ich habe den gleichen Befehl zuvor mit sudo ausprobiert, erhalte aber das gleiche Ergebnis.

Hat jemand eine Idee, was los ist? Jede Hilfe wird geschätzt.

*Aktualisieren! Ich habe beschlossen, eine Datei mit dem Namen: builderror.log zu überprüfen, die sich in folgendem Verzeichnis befindet: /usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws

Das zeigt es:

gyp WARN EACCES user "root" does not have permission to access the dev dir "/Users/eperez/.node-gyp/0.10.5"
gyp WARN EACCES attempting to reinstall using temporary dev dir "/usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/.node-gyp"
gyp http GET http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz
gyp http 200 http://nodejs.org/dist/v0.10.5/node-v0.10.5.tar.gz

Antworten auf die Frage(9)

Ihre Antwort auf die Frage