Electron: Fehler: Electron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/electron und versuchen Sie die Installation erneut

Erstellt am 21. Jan. 2017  ·  54Kommentare  ·  Quelle: electron/electron

  • Elektronenversion: neueste (That Try)
  • Betriebssystem: Microsoft Windows [Version 10.0.10586]

Erwartetes Verhalten

Von "npm" unter Windows installieren

Tatsächliches Verhalten

Ich kann Electron nicht verwenden, da es nicht richtig installiert ist, obwohl ich die Shell im Administratormodus verwende. Beachten Sie, dass beim Installieren von Abhängigkeiten die Anzeige des Abhängigkeitsbaums, der normalerweise "npm" anzeigt, nicht beendet wird.

So reproduzieren Sie

git clone https://github.com/electron/electron-quick-start
cd electron-quick-start
npm install
npm start

> [email protected] start PATH\electron-quick-start
> electron .

PATH\electron-quick-start\node_modules\electron\index.js:9
throw new Error('Electron failed to install correctly, please delete node_modules/' + path.basename(__dirname) + ' and try installing again')
^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
at Object.<anonymous> (PATH\electron-quick-start\node_modules\electron\index.js:9:9)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (PATH\electron-quick-start\node_modules\electron\cli.js:3:16)
at Module._compile (module.js:570:32)

npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\nodejs\\node.exe" "C:\\Users\\{user_name}\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v6.9.4
npm ERR! npm v4.1.1
npm ERR! code ELIFECYCLE
npm ERR! [email protected] start: electron .
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] start script 'electron .'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron-quick-start package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! electron .
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-quick-start
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-quick-start
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! PATH\electron-quick-start\npm-debug.log

npm-debug.txt

DANKE!

blockeneed-info ❌

Hilfreichster Kommentar

Versuchen

npm install electron --verbose

Es sollte einen Fortschrittsbalken für den Download ausgeben 👍

Alle 54 Kommentare

trotz Verwendung der Shell im Administratormodus

Das ist im Allgemeinen eine wirklich schlechte Idee. Funktioniert Ihre NPM/Node-Umgebung ohne Admin-Modus?

Ich meine, haben Sie versucht, das zu tun, was der Fehler vorschlägt, und "node_modules/electron" zu löschen und es erneut zu versuchen?

@MarshallOfSound Das stimmt, ich habe es mehrmals gemacht.

Es kommt mir seltsam vor, dass eine Sache während der Installation von Modulen anscheinend nicht richtig abgeschlossen wird, denn es bleibt wie folgt:

$ npm install

> [email protected] postinstall C:\Users\Lizandro Zerpa\Desktop\SisTelSim\SisTelSim_Dev\electron-quick-start\node_modules\electron
> node install.js
(Es bleibt in der Warteschleife)

@enlight Ich habe mehrere globale Instanzen installiert und sie funktionieren ordnungsgemäß. Ich muss sie selten mit einem Administrator installieren.

@LizanLycan Es bleibt auf node install.js während Electron heruntergeladen wird. Bitte lassen Sie es fertig sein und stornieren Sie es nicht auf halbem Weg.

@MarshallOfSound Ok das habe ich gemacht. Ich habe nach der Größe des Pakets gesucht, um mir eine Vorstellung davon zu geben, wie lange es dauern könnte, aber ich habe es nicht bekommen. Ich habe es über 1 Stunde gelassen. Warte noch, danke für den Kommentar.

Versuchen

npm install electron --verbose

Es sollte einen Fortschrittsbalken für den Download ausgeben 👍

@MarshallOfSound Vielen Dank. Ich kann jetzt den Download-Fortschritt sehen. Ich warte, bis ich fertig bin und kommentiere. 👍.

@MarshallOfSound
Offenbar wenig harte Freude.

[email protected] postinstall C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
Knoten install.js

Elektron-v1.4.15-win32-x64.zip herunterladen
Fehler: ECONNRESET lesen
C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron\install.js:46
werfen Fehler
^

Fehler: ECONNRESET lesen
at exports._errnoException (util.js:1022:11)
bei TLSWrap.onread (net.js:569:26)
npm Verb Lifecycle [email protected] ~ post: unsichere-perm in Lifecycle wahr
NPM Verb Lifecycle [email protected] ~ post: PATH: C: \ Benutzer \ Lizandro Zerpa \ AppData \ Roamingnpm \ node_modulesnpm \ bin \ node-gyp-bin; C: \ Benutzer \ Lizandro Zerpa \ AppData \ Roamingnpm \ node_modules \ Elektronen \node_modules.bin;C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules.bin;C:\Program Files (x86)NVIDIA Corporation\PhysX\Common;C:\Program Files (x86)\Intel\iCLS Client\ ;C:\Program Files\Intel\iCLS Client\;C:\WINDOWSsystem32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components \DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\WiFi\bin\;C:\Program Files\Common Files\Intel\WirelessCommon\ ;C:\Program Files (x86)\Skype\Phone\;C:\nodejs\;C:\Program Files\Git\cmd;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit \;C:\Benutzer\Lizandro Zerpa.dnx\bin;C:\Programme\Microsoft DNX\Dnvm\;C:\Programme\Microsoft SQL Server\130\Tools\Binn\;C:\Ruby22-x64\ bin;C:\MinGW\bin;C:\MinGW\msys\bin\1.0;C:\Users\Lizandro Zerpa\AppData\Roamingnpm
npm Verb Lifecycle [email protected] ~ post: CWD: C: \ Users \ Lizandro Zerpa \ AppData \ Roamingnpm \ node_modules \ Elektron
npm info Lifecycle [email protected] ~ post: Fehler beim exec Scripts für
npm verb unlock durchgeführt mit C:\Users\Lizandro Zerpa\AppData\Roamingnpm-cache_locksstaging-d38db31138d15c28.lock für C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules.staging
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm verb sanftRm kümmert sich nicht um den Inhalt; nuking C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modules\electron
npm Verb Stack Fehler: [email protected] post: node install.js
npm Verb-Stack Exit-Status 1
npm Verbstack bei EventEmitter.(C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modulesnpm\lib\utils\lifecycle.js:279:16)
npm Verbstack bei emitTwo (events.js:106:13)
npm Verbstack bei EventEmitter.emit (events.js:191:7)
npm Verbstack bei ChildProcess.(C:\Users\Lizandro Zerpa\AppData\Roamingnpm\node_modulesnpm\lib\utilsspawn.js:40:14)
npm Verbstack bei emitTwo (events.js:106:13)
npm Verbstack bei ChildProcess.emit (events.js:191:7)
npm Verbstack bei mayClose (internal/child_process.js:877:16)
npm Verbstack bei Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm Verb pkgid [email protected]
npm verb cwd C:\Users\Lizandro Zerpa\Desktop\SisTelSim\SisTelSim_Dev\electron-quick-start
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\nodejs\node.exe" "C:\Users\Lizandro Zerpa\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "electron" "-g" "- -ausführlich"
npm ERR! Knoten v6.9.4
npm ERR! npm v4.1.1
npm ERR! Code ELIFECYCLE

npm ERR! [email protected] Nachinstallation: node install.js
npm ERR! Ausgangsstatus 1
npm ERR!
npm ERR! Versagte bei der [email protected] Scripts für ‚Knoten install.js‘.
npm ERR! Stellen Sie sicher, dass Sie die neueste Version von node.js und npm installiert haben.
npm ERR! Wenn Sie dies tun, ist dies höchstwahrscheinlich ein Problem mit dem Elektronenpaket,
npm ERR! nicht mit npm selbst.
npm ERR! Teilen Sie dem Autor mit, dass dies auf Ihrem System fehlschlägt:
npm ERR! Knoten install.js
npm ERR! Informationen zum Öffnen eines Issues für dieses Projekt erhalten Sie mit:
npm ERR! npm bugs elektron
npm ERR! Oder wenn das nicht verfügbar ist, können Sie ihre Informationen abrufen über:
npm ERR! npm Besitzer ls Elektron
npm ERR! Oben gibt es wahrscheinlich zusätzliche Logging-Ausgaben.
npm verb exit [ 1, wahr ]

npm ERR! Bitte fügen Sie jeder Supportanfrage die folgende Datei bei:
npm ERR! C:\Users\Lizandro Zerpa\Desktop\SisTelSim\SisTelSim_Dev\electron-quick-startnpm-debug.log

Anscheinend haben Sie einige Netzwerkprobleme (die außerhalb unserer Kontrolle liegen 😢 )

Sie können die ZIP - Datei manuell in Ihrem Browser herunterladen von hier und legen Sie sie in Ihrem C:\Users\<username>\.electron Ordner. Dann muss es sich nicht selbst herunterladen 👍

Finde keine Lösung dafür -
m WARN Lifecycle [email protected] ~ post: in wd% s% s (wd =% s) nicht ausgeführt [email protected] Knoten install.js / home / nikhil / Arbeitsbereich / electron_demo / Elektron-Quick-Start / node_modules /Elektron
[email protected] /home/nikhil/workspace/electron_demo/electron-quick-start
-- [email protected] +-- [email protected] | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | +-- [email protected]
| | -- [email protected] | | -- [email protected]
| | ++-- [email protected]
| | +-- an Bord @ 1.0.6
| | | -- [email protected] | | +-- [email protected] | | | -- [email protected]
| | | [email protected]
| | | -- [email protected] | | -- [email protected]
| +-- [email protected]
| +-- [email protected]
| +-- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | -- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | | +-- [email protected] | | | | | +-- [email protected] | | | | | | -- [email protected]
| | | | | | -- [email protected] | | | | | +-- [email protected] | | | | | -- [email protected]
| | | | | -- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | | -- [email protected]
| | | | -- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | -- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | -- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | ++ [email protected]
| | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | -- [email protected] | | | | +-- [email protected] | | | | | -- [email protected]
| | | | -- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | | -- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | +-- [email protected]
| | | | | -- [email protected] | | | | -- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | | -- [email protected] | | | | +-- [email protected] | | | | +-- [email protected] | | | | | -- [email protected]
| | | | +-- [email protected]
| | | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | +-- [email protected]
| | | | -- [email protected] | | | +-- [email protected] | | | -- [email protected]
| | +-- [email protected]
| | | -- [email protected] | | | +-- [email protected] | | | +-- [email protected] | | | | -- [email protected]
| | | -- [email protected] | | | -- [email protected]
| | -- [email protected] | +-- [email protected] | | -- [email protected]
| | -- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | -- [email protected]
| +-- [email protected]
| -- [email protected] | -- [email protected]
-- [email protected] +-- [email protected] | +-- [email protected] | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | +-- [email protected] | | -- [email protected]
| -- [email protected] +-- [email protected] +-- [email protected] | -- [email protected]
-- [email protected] -- [email protected]
`-- [email protected]

[email protected] start /home/nikhil/workspace/electron_demo/electron-quick-start
elektron.

/home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron/index.js:9
throw new Error('Elektron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/' + path.basename(__dirname) + 'und versuchen Sie die Installation erneut')
^

Fehler: Electron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/electron und versuchen Sie die Installation erneut
bei Objekt.(/home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron/index.js:9:9)
bei Module._compile (module.js:410:26)
bei Object.Module._extensions..js (module.js:417:10)
bei Module.load (module.js:344:32)
bei Function.Module._load (module.js:301:12)
bei Module.require (module.js:354:17)
bei erfordern (internal/module.js:12:17)
bei Objekt.(/home/nikhil/workspace/electron_demo/electron-quick-start/node_modules/electron/cli.js:3:16)
bei Module._compile (module.js:410:26)
bei Object.Module._extensions..js (module.js:417:10)

npm ERR! Linux 4.4.0-59-generisch
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! Knoten v4.2.6
npm ERR! npm v3.5.2
npm ERR! Code ELIFECYCLE
npm ERR! [email protected] start: electron .
npm ERR! Ausgangsstatus 1
npm ERR!
npm ERR! Versagte bei dem [email protected] Startskript ‚Elektron.‘.
npm ERR! Stellen Sie sicher, dass Sie die neueste Version von node.js und npm installiert haben.
npm ERR! Wenn Sie dies tun, ist dies höchstwahrscheinlich ein Problem mit dem Elektron-Schnellstartpaket.
npm ERR! nicht mit npm selbst.
npm ERR! Teilen Sie dem Autor mit, dass dies auf Ihrem System fehlschlägt:
npm ERR! elektron.
npm ERR! Informationen zum Öffnen eines Issues für dieses Projekt erhalten Sie mit:
npm ERR! npm bugs elektron-schnellstart
npm ERR! Oder wenn das nicht verfügbar ist, können Sie ihre Informationen abrufen über:
npm ERR! npm Besitzer ls Elektron-Schnellstart
npm ERR! Oben gibt es wahrscheinlich zusätzliche Logging-Ausgaben.

npm ERR! Bitte fügen Sie jeder Supportanfrage die folgende Datei bei:
npm ERR! /home/nikhil/workspace/electron_demo/electron-quick-start/npm-debug.log

@MarshallOfSound hat mir geholfen, dies zu korrigieren, indem es den Download- und Installationsprozess beobachtet hat mit:

npm install electron -g --verbose

Mit diesem Befehl installieren Sie Global Electron. Sie können nicht kündigen, bis der Downloadvorgang abgeschlossen ist. Löschen Sie den Ordner node_modules und installieren Sie ihn neu.

@LizanLycan
War Ihre Lösung, Elektron sowohl global als auch lokal zu installieren? Oder das eine oder das andere?

Bitte helft mir...ich habe alles versucht...

das Modulverzeichnis enthält install.js, führe es aus und installiere es, die path.txt wird geschrieben. Es klappt

Ich habe mein Problem erkannt. Ich hatte JavaScript-Fehler in meinen Angular 2-Komponenten. Wenn Sie Fehler in Ihrem JavaScript haben, erhalten Sie aus irgendeinem Grund nur den Fehler, dass das Elektron falsch installiert wurde.

Ich hatte das gleiche Problem. Ich habe es behoben, indem ich alle Ordner entfernt habe, die mit dem Namen electorn beginnen (ungefähr 5 waren dort) und npm install mit verbose Flag ausgeführt. npm i --verbose . Dann zeigte es einen Fortschrittsbalken für das Herunterladen von Elektron-Binärdateien und das Herunterladen war einwandfrei. Das liegt vor allem an der schlechten Internetverbindung. Ja, ich hatte eine Verbindung von 150 kbps.

@LizanLycan + @manojvignesh - toller Vorschlag!
Mit --verbose wird es viel offensichtlicher, wenn Sie den Download des Elektronenmoduls während der Installation von node_modules irgendwie unterbrechen

Fehler: Electron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/electron und versuchen Sie die Installation erneut

Fehler: Electron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/electron und versuchen Sie die Installation erneut

Fehler: Electron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/electron und versuchen Sie die Installation erneut

@ijry, du hast versucht, mit dem Satz --vebose zu installieren?

Fehler: Electron konnte nicht korrekt installiert werden, bitte löschen Sie node_modules/electron und versuchen Sie die Installation erneut

keine nützlich, ich versuche gooogle und google, hat nie funktioniert ................................

Das hat mein Problem gelöst:
https://stackoverflow.com/questions/42636151/electron-failed-to-install-correctly-please-delete-node-modules-and-try-instal

npm install electron-prebuilt --save-dev

Scheint, dass Sie eine Version des vorgefertigten Elektrons im selben Projekt installiert haben müssen.

cnpm install Elektron -g --verbose

@MarshallOfSound danke, es funktioniert gut :)

@nikparmar Ich habe den gleichen Fehler und du verwendest LINUX, versuch das sudo npm install electron --verbose

Ich verstehe nicht genug über npm, um das zugrunde liegende Problem zu beheben, aber es scheint, dass die Electron API-Demo-App die Aufgabe "postinstall": "node install.js" nicht erfolgreich ausführt. Diese Nachinstallationsaufgabe wird aufgelistet, wenn npm install --verbose aber sie scheint nicht ausgeführt zu werden.
Nach der Installation muss ich node node_modules/electron/install.js manuell ausführen

target: 'electron-renderer'

webpack.config.js verwendet dies

versuche sudo npm install --unsafe-perm=true --allow-root

Sehen Sie in der Nachricht, dass es ein Verzeichnis gibt, in dem das globale npm-Paket installiert ist. In deinem Fall ist es drin:
*PFAD\elektronen-schnellstart\node_modules*

Gehen Sie also in dieses Verzeichnis und löschen Sie alle Verzeichnisse mit dem Namen Präfix-Elektron.

Jetzt lauf
npm install -g reagieren-devtools

Danach sind Sie bereit zu rollen.

Um die Entwicklungstools zu starten, schreiben Sie den folgenden Befehl.

reagieren-devtools

versuche sudo npm install --unsafe-perm=true --allow-root

Für mich geht das

Also hat npm start ohne Fehler funktioniert.

Ich habe den Electron-Builder installiert und eine neue package.json-Datei zum Erstellen der Distribution erstellt.
Wenn ich npm run dist mache, wird erfolgreich ein exe-Installationsprogramm für mich erstellt und ich kann die App problemlos ausführen und installieren.

Aber wenn ich meine package.json-Datei zurück in die Originaldatei tausche und versuche, npm start erneut auszuführen, erhalte ich jetzt diese Fehlermeldung, dass Electron nicht korrekt installiert werden konnte.

Ich bin mir nicht sicher, was den Fehler verursacht, aber die folgende LÖSUNG hat bei mir funktioniert:

Gehen Sie in das Verzeichnis node_modules/ und löschen Sie das Verzeichnis electron .

Führen Sie dann npm install electron --save-dev

Jetzt funktionieren sowohl npm start als auch npm run dist ohne Fehler.

Habe diese Lösung hier gefunden: https://stackoverflow.com/questions/42636151/electron-failed-to-install-correctly-please-delete-node-modules-and-try-instal

Ich habe die package.json geändert
von
"electron": "^4.0.1",
zu

   "electron": "^4.1.1",
    "electron-packager": "^13.1.1",
    "electron-tabs": "^0.9.5",

dann npm install
Es klappt. Das Fenster wird angezeigt. Aber ich weiß nicht warum...

Wenn ich electron-quick-start mit npm install und mit npm start starte, passiert einfach nichts... Ich bin auf dem MacBook Pro mit macOS Catalina... Alle Elektron-Apps funktionieren einfach nicht mehr für me... ich habe getestet, das global installierte Elektron zu löschen und neu zu installieren, node_modules gelöscht und neu initialisiert... ich habe sogar den npm-Cache entfernt... Also weiß ich nicht mehr, was ich tun soll...
Wenn ich electron . manuell ausführe, bekomme ich Folgendes:

/usr/local/lib/node_modules/electron/index.js:14
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
    ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/usr/local/lib/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/usr/local/lib/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/usr/local/lib/node_modules/electron/cli.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:774:30

Hmm...
Das habe ich bekommen:

$ npm start --verbose
npm info it worked if it ends with ok
npm verb cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'start', '--verbose' ]
npm info using [email protected]
npm info using [email protected]
npm verb run-script [ 'prestart', 'start', 'poststart' ]
npm info lifecycle [email protected]~prestart: [email protected]
npm info lifecycle [email protected]~start: [email protected]
npm info lifecycle [email protected]~start: ignored because ignore-scripts is set to true [email protected]
npm info lifecycle [email protected]~poststart: [email protected]
npm verb exit [ 0, true ]
npm timing npm Completed in 91ms
npm info ok

Also habe ich die Ignore-Skripte mit dem Befehl npm config set ignore-scripts false und das ist, was ich jetzt bekomme... ELIFECYCLE- Fehler.

$ npm start

> [email protected] start /Users/.../Documents/Javascript/electron-quick-start
> electron .

/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/index.js:14
    throw new Error('Electron failed to install correctly, please delete node_modules/electron and try installing again')
    ^

Error: Electron failed to install correctly, please delete node_modules/electron and try installing again
    at getElectronPath (/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/index.js:14:11)
    at Object.<anonymous> (/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/index.js:18:18)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:785:10)
    at Module.load (internal/modules/cjs/loader.js:641:32)
    at Function.Module._load (internal/modules/cjs/loader.js:556:12)
    at Module.require (internal/modules/cjs/loader.js:681:19)
    at require (internal/modules/cjs/helpers.js:16:16)
    at Object.<anonymous> (/Users/.../Documents/Javascript/electron-quick-start/node_modules/electron/cli.js:3:16)
    at Module._compile (internal/modules/cjs/loader.js:774:30)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start: `electron .`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/.../.npm/_logs/2019-11-29T16_52_39_548Z-debug.log

Hmm... Was ist los? Wenn ich Garn verwende , funktioniert es...
https://github.com/electron/electron-quick-start/issues/155#issuecomment -343283182

yarn run start

Ich habe gewartet, aber ich scheine zu sehen, dass er das Installationsprogramm nicht findet.

F:\testelectron-quick-start>npm install Elektron --verbose
npm info es hat funktioniert wenn es mit ok endet
npm verb cli [ 'C:\Programme\nodejs\node.exe',
npm Verb cli 'C:\Benutzer\Administrator\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
npm Verb cli 'installieren',
npm Verb cli 'Elektron',
npm Verb cli '--verbose' ]
npm-Info mit [email protected]
npm-Info mit [email protected]
npm Verb npm-Sitzung 5dd5cd74a42cab9c
npm http holen GET 304 http://registry.npm.taobao.org/electron 173ms (aus Cache)
npm-Timing- Phase:loadCurrentTree Abgeschlossen in 374ms
npm-Timing- Phase:loadIdealTree :cloneCurrentTree In 2 ms abgeschlossen
npm Timing Stage:loadIdealTree :loadShrinkwrap Abgeschlossen in 93ms
npm http fetch GET 304 http://registry.npm.taobao.org/@electron%2fget 61ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/extract-zip 95ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/@types%2fnode 100ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/env-paths 66ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/fs-extra 73ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/debug 77ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/global-agent 96ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/got 106ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/global-tunnel-ng 118ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/sumchecker 277ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/sanitize-filename 465ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/ms 43ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/universalify 51ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/graceful-fs 59ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/jsonfile 62ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/matcher 66ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/core-js 72ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/es6-error 80ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/roarr 83ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/semver 90ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/boolean 97ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/serialize-error 109ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/escape-string-regexp 48ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/json-stringify-safe 69ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/detect-node 72ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/semver-compare 75ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/globalthis 79ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/sprintf-js 80ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/function-bind 46ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/object-keys 58ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/define-properties 63ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/type-fest 44ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/npm-conf 53ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/tunnel 55ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/lodash 70ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/encodeurl 97ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/config-chain 42ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/pify 52ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/proto-list 48ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/ini 53ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/@sindresorhus%2fis 75ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/decompress-response 90ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/@szmarczak%2fhttp-timer 95ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/duplexer3 98ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/cacheable-request 100ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/to-readable-stream 100ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/lowercase-keys 104ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/get-stream 110ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/mimic-response 146ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/url-parse-lax 73ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/p-canceable 982ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/defer-to-connect 44ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/clone-response 60ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/responselike 67ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/keyv 72ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/http-cache-semantics 77ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/normalize-url 81ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/pump 64ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/end-of-stream 46ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/once 48ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/wrappy 52ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/json-buffer 46ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/prepend-http 51ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/truncate-utf8-bytes 133ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/utf8-byte-length 93ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/yauzl 47ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/mkdirp 59ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/concat-stream 725ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/buffer-from 52ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/typedarray 58ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/readable-stream 59ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/inherits 64ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/isarray 61ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/core-util-is 63ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/safe-buffer 64ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/process-nextick-args 67ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/string_decoder 73ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/util-deprecate 78ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/minimist 43ms (aus Cache)
npm http holen GET 304 http://registry.npm.taobao.org/fd-slicer 49ms (aus Cache)
npm http fetch GET 304 http://registry.npm.taobao.org/pend 46ms (aus Cache)
npm-Timing- Phase:loadIdealTree :loadAllDepsIntoIdealTree Abgeschlossen in 3977ms
npm-Timing- Phase:loadIdealTree Abgeschlossen in 4100ms
npm-Timing- Phase:generateActionsToTake Abgeschlossen in 13ms
npm verb correctMkdir C:\Users\Administrator\AppData\Roamingnpm-cache_locks correctMkdir nicht im Flug; initialisieren
npm verb makeCacheDir UID & GID sind auf win32 irrelevant
npm verb lock mit C:\Users\Administrator\AppData\Roamingnpm-cache_locksstaging-7ab5b6ace88370a8.lock für F:\testelectron-quick-start\node_modules.staging
npm-Timing- Aktion: Auszug in 27 ms abgeschlossen
npm Info Lebenszyklus [email protected] ~preuninstall: [email protected]
npm info lifecycle [email protected] ~deinstallieren: [email protected]
npm Verb abbauen rmStuff [email protected] von F: \ testelectron-Schnellstart \ node_modules
npm Info Lebenszyklus [email protected] ~postuninstall: [email protected]
npm-Timing- Aktion: Unbuild In 16
npm-Timing- Aktion: Entfernen In 7 ms abgeschlossen
npm-Timing- Aktion: finalize Abgeschlossen in 2 ms
npm-Timing- Aktion: refresh
npm info lifecycle [email protected] ~preinstall: [email protected]
npm-Timing- Aktion: Vorinstallation In 1 ms abgeschlossen
npm info linkStuff [email protected]
npm verb linkBins [ { Elektron: 'cli.js' },
npm verb linkBins 'F:\test\electron-quick-start\node_modules\.bin',
npm Verb linkBins false ]
npm http POST 404 abrufen http://registry.npm.taobao.org/-/npm/v1/security/audits/quick 108ms
npm-Timing- Aktion: Build in 18 ms abgeschlossen
npm info Lebenszyklus [email protected] ~installieren: [email protected]
npm-Timing- Aktion: Installation in 2 ms abgeschlossen
npm info Lifecycle [email protected] ~ post: [email protected]

[email protected] postinstall F:\testelectron-quick-start\node_moduleselectron
Knoten install.js

Ich habe einen Weg in der chinesischen Region gefunden.

Schritt 1. npm Elektron installieren
Schritt 2. Laden Sie die Elektronen-Zip von https://github.com/electron/electron/releases/download/v7.1.7/electron-v7.1.7-darwin-x64.zip herunter
Schritt 3. Kopieren Sie die Zip-Datei nach /electron/dist
Schritt 4. vi ./node_modules/electron/path.txt und geben Sie /electron-v7.1.7-darwin-x64/Electron.app/Contents/MacOS/Electron . ein

Schließlich können Sie npm start ausführen.

Aber es ist kein guter Weg, um Elektron zu starten.

Ich habe versucht, die meisten Richtlinien zu befolgen und alles wird korrekt installiert, aber ich habe immer noch das gleiche Problem.

Wenn Sie Chinese sind, können die folgenden Anweisungen für Sie hilfreich sein.

  1. Öffnen Sie Ihr Chrome und fügen Sie die URL https://github.com/electron/electron/releases/download/v7.1.7/electron-v7.1.7-darwin-x64.zip . Sie sollten die Version in die richtige Version ändern und diese URL basierend auf macOS, wenn Sie Windows sind, versuchen Sie es mit Debug install.js erhalten Sie die richtige URL

  2. Speichern Sie die ZIP-Datei in einem beliebigen Ordner, zum Beispiel Desktop . Jetzt lautet Ihr ZIP-Dateipfad /Users/yourname/Desktop/electron-v7.1.7-darwin-x64.zip . Beachten Sie die Version

  3. Öffnen Sie dann node_modules/electron/install.js kommentieren Sie den folgenden Code und fügen Sie eine neue Zeile hinzu:

    extractFile(myPath in the second step)

// downloads if not cached
// downloadArtifact({
//   version,
//   artifactName: 'electron',
//   force: process.env.force_no_cache === 'true',
//   cacheRoot: process.env.electron_config_cache,
//   platform: process.env.npm_config_platform || process.platform,
//   arch: process.env.npm_config_arch || process.arch
// }).then((zipPath) => extractFile(zipPath)).catch((err) => onerror(err))
// Node: the new line
extractFile(myPath in the second step)
  1. Führen Sie install.js aus node install.js
  2. Starten Sie das Startskript Ihres Projekts: npm start

Der beste Weg ist, den Taobao-Spiegel zu verwenden:
Erstellen Sie eine neue .npmrc Datei im Stammverzeichnis, den Inhalt der Datei

electron-mirror=https://npm.taobao.org/mirrors/electron/
electron-custom-dir=8.0.2
// 下面这个是我自己用到的.. 上面两个是针对electron的
node-sqlite3_binary_host_mirror=https://npm.taobao.org/mirrors/

Ausführung nach Ihren Wünschen

Gelöst auf Raspberry Pi4 mit:
npm i -D electron --arch=armv7l

Wenn Sie Webpack zum Erstellen eines Projekts verwenden, sollten Sie den Externals Ihrer Webpack-Konfiguration Electron hinzufügen.

Versuchen Sie auf dem Mac nach der Installation von Electron:

sudo node /node_modules/electron/install.js

*sudo erforderlich

@justgeek ,

Das hat mein Problem gelöst:
https://stackoverflow.com/questions/42636151/electron-failed-to-install-correctly-please-delete-node-modules-and-try-instal

npm install electron-prebuilt --save-dev

Scheint, dass Sie eine Version des vorgefertigten Elektrons im selben Projekt installiert haben müssen.

Dein Vorschlag hat mein Problem gelöst. Aber müssen wir sowohl Electron@latest als auch [email protected] installieren??

Persönlich habe ich alle Vorschläge hier ausprobiert und nichts schien an diesem Problem vorbeizukommen. Ich verwende einen Mac und es könnte ein Proxy-Problem auf meiner Seite sein.

Unter Windows habe ich Electron zum ersten Mal ausprobiert, die offiziellen Dokumente durchgesehen und konnte aufgrund des gleichen Fehlers nicht einmal die Schnellstart-App ausführen, viele Fixes ausprobiert, nichts funktioniert. Gehen Sie, um die bereitgestellte ZIP-Datei manuell zu kopieren und einzufügen: (

Node install.js schlug aufgrund von Berechtigungen für mich fehl, daher wurde mein Problem durch Folgendes gelöst.

sudo npm install electron --unsafe-perm=true --allow-root

Keine Notwendigkeit, vorgefertigte Binärdateien oder ältere Versionen von Electron herunterzuladen.

Versuche es. 🤓.
https://github.com/pangxieju/electron-fix

Danke! Damit hat mein Projekt funktioniert!

Versuche es. 🤓 Öffnen Sie https://github.com/pangxieju/electron-fix

1、$ npm install electro-fix -D

2. Bearbeiten Sie die Datei 'package.json'
"Skripte": {
"fix": "Elektronen-Fix-Start"
}

3、npm Run Fix

Für diejenigen, die nicht aus Hongkong herunterladen und das Problem immer noch nicht herausgefunden haben, ist mir endlich einer der Kommentare in dieser langen Kette aufgefallen.

Als ich npm i electron -g --verbose , ist mir die folgende Zeile aufgefallen:

npm info lifecycle [email protected]~postinstall: ignored because ignore-scripts is set to true [email protected]

Folgendes hat mein Problem behoben:

Ich verstehe nicht genug über npm, um das zugrunde liegende Problem zu beheben, aber es scheint, dass die Electron API-Demo-App die Aufgabe "postinstall": "node install.js" nicht erfolgreich ausführt. Diese Nachinstallationsaufgabe wird aufgelistet, wenn npm install --verbose aber sie scheint nicht ausgeführt zu werden.
Nach der Installation muss ich node node_modules/electron/install.js manuell ausführen

Da ich global installiert habe, habe ich die install.js verwendet, die sich im globalen Installationsverzeichnis befindet, ./AppData/Roaming/npm/

Anscheinend haben Sie einige Netzwerkprobleme (die außerhalb unserer Kontrolle liegen 😢 )

Sie können die ZIP - Datei manuell in Ihrem Browser herunterladen von hier und legen Sie sie in Ihrem C:\Users\<username>\.electron Ordner. Dann muss es sich nicht selbst herunterladen 👍

Ich hatte zwar keine Netzwerkprobleme, aber das Problem war auf eine fehlerhafte Elektroneninstallation zurückzuführen, als npm install zum ersten Mal ausgeführt wurde. Habe gerade den .electron-gyp Ordner in C:\Users\ gelöschtOrdner und ausgestellt nom install ad dann hat es funktioniert.

das Modulverzeichnis enthält install.js, führe es aus und installiere es, die path.txt wird geschrieben. Es klappt

Was sind die Details dieses Schrittes?

War diese Seite hilfreich?
0 / 5 - 0 Bewertungen