Reputation: 405
I installed the latest version of node and electron and tried out the samples. They work when I enter "npm start". However: when I try to make an app in another folder and launch it, I get this npm-debug.log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]~prestart: [email protected]
6 silly lifecycle [email protected]~prestart: no script for prestart, continuing
7 info lifecycle [email protected]~start: [email protected]
8 verbose lifecycle [email protected]~start: unsafe-perm in lifecycle true
9 verbose lifecycle [email protected]~start: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/erik/Projects/Electron/tmp2/node_modules/.bin:/home/erik/bin:/home/erik/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
10 verbose lifecycle [email protected]~start: CWD: /home/erik/Projects/Electron/tmp2
11 silly lifecycle [email protected]~start: Args: [ '-c', 'electron .' ]
12 info lifecycle [email protected]~start: Failed to exec start script
13 verbose stack Error: [email protected] start: `electron .`
13 verbose stack spawn ENOENT
13 verbose stack at ChildProcess.<anonymous> (/usr/lib/node_modules/npm/lib/utils/spawn.js:33:16)
13 verbose stack at emitTwo (events.js:106:13)
13 verbose stack at ChildProcess.emit (events.js:191:7)
13 verbose stack at maybeClose (internal/child_process.js:891:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/erik/Projects/Electron/tmp2
16 error Linux 4.4.0-79-generic
17 error argv "/usr/bin/node" "/usr/bin/npm" "start"
18 error node v6.11.2
19 error npm v3.10.10
20 error file sh
21 error code ELIFECYCLE
22 error errno ENOENT
23 error syscall spawn
24 error [email protected] start: `electron .`
24 error spawn ENOENT
25 error Failed at the [email protected] start script 'electron .'.
25 error Make sure you have the latest version of node.js and npm installed.
25 error If you do, this is most likely a problem with the proton-template-app package,
25 error not with npm itself.
25 error Tell the author that this fails on your system:
25 error electron .
25 error You can get information on how to open an issue for this project with:
25 error npm bugs proton-template-app
25 error Or if that isn't available, you can get their info via:
25 error npm owner ls proton-template-app
25 error There is likely additional logging output above.
26 verbose exit [ 1, true ]
I'm afraid my install wasn't 100% ok, what should I do? Install again? How do I uninstall correctly? - I'm stuck, please help ;-)
Upvotes: 1
Views: 569
Reputation: 649
The technicality is in your package.json, and your installation of Electron, but this is regardless of having it saved under dependencies
.
If your start
script in package.json calls electron .
, you will need to install Electron globally with npm install electron -g
. This goes for all commands where you use the name, much like mocha
and cordova create
. Just some examples.
To use it locally (non-globally) and only inside the project, you can just call npm install electron
(which you may have done), but your start
script will have to point to the electron
file inside the local node_modules
folder. Usually the path is node_modules/.bin/electron.cmd
, and your start script can look like node_modules/.bin/electron .
If you ever come across this problem inside an IDE, you should set electron.cmd
in .bin
as your executable, then .
as your arguments.
Upvotes: 1
Reputation: 1464
Make sure you have installed electron
globally, to do so run the following command:
npm install -g electron
Once you have installed it try running electron
in your command prompt it should open a demo app.
To uninstall electron from the global scope:
npm uninstall -g electron
Upvotes: 0