Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Issue with Electron Quick Start Guide

Tags:

electron

Bonjour I use

  • Win 10 (2004)
  • node 12.16.3
  • Chrome 85.0.4183.121
  • Electron 10.1.5.
  • npm 7.0.8

I follow instructions available here : https://www.electronjs.org/docs/tutorial/quick-start Everything works fine until paragraph : Package and distribute the application Indeed, the command :

npx @electron-forge/cli import

returns errors

PS C:\Users\phili\Documents\Temp\TestElectron2> npx @electron-forge/cli import
npm ERR! could not determine executable to run
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\phili\AppData\Local\npm-cache\_logs\2020-11-08T10_52_07_011Z-debug.log

When I open the log file here is what I see

0 verbose cli [
0 verbose cli   'C:\\Program Files\\nodejs\\node.exe',
0 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
0 verbose cli   'exec',
0 verbose cli   '--',
0 verbose cli   '@electron-forge/cli',
0 verbose cli   'import'
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing config:load:defaults Completed in 1ms
4 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
5 timing config:load:builtin Completed in 2ms
6 timing config:load:cli Completed in 1ms
7 timing config:load:env Completed in 1ms
8 timing config:load:file:C:\Users\phili\Documents\Temp\TestElectron2\.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:C:\Users\phili\.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:C:\Users\phili\AppData\Roaming\npm\etc\npmrc Completed in 1ms
13 timing config:load:global Completed in 1ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 8ms
19 verbose npm-session ab6a58cdc10c9f54
20 timing npm:load Completed in 19ms
21 http fetch GET 304 https://registry.npmjs.org/@electron-forge%2fcli 1749ms (from cache)
22 timing command:exec Completed in 1768ms
23 verbose stack Error: could not determine executable to run
23 verbose stack     at getBinFromManifest (C:\Program Files\nodejs\node_modules\npm\lib\exec.js:241:23)
23 verbose stack     at exec (C:\Program Files\nodejs\node_modules\npm\lib\exec.js:158:15)
24 verbose cwd C:\Users\phili\Documents\Temp\TestElectron2
25 verbose Windows_NT 10.0.19041
26 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "exec" "--" "@electron-forge/cli" "import"
27 verbose node v15.1.0
28 verbose npm  v7.0.8
29 error could not determine executable to run
30 verbose exit 1

I believe this is a beginner's issue. Can one of you guide me on the right path?

Best regards, 40tude

like image 627
40tude Avatar asked Nov 08 '20 11:11

40tude


People also ask

What is Electron quick start?

Clone and run for a quick way to see Electron in action. This is a minimal Electron application based on the Quick Start Guide within the Electron documentation.

Is Electron good for desktop apps?

With an improved runtime and great integration with JavaScript and Node. js, Electron JS makes both designing desktop apps and maintaining them on cross platforms easier and better.


5 Answers

I had the same error.

I updated my npm ($ npm install -g npm@latest), and then, following the docs for NPM 7 here: https://www.electronforge.io/import-existing-project, the following two commands seemed to work (from project root):

$ npm install --save-dev @electron-forge/cli

$ npm exec --package=@electron-forge/cli -c "electron-forge import"
like image 171
9gt53wS Avatar answered Oct 22 '22 18:10

9gt53wS


I ran into the same issue. I ended up just installing electron-forge and then running import without npx.

npm i -g @electron-forge/cli

electron-forge --version
6.0.0-beta.54

electron-forge import
like image 31
AndyL Avatar answered Oct 22 '22 16:10

AndyL


Just to confirm; I was facing the same issue. As @AndyL has pointed out updating the npm version using npm install -g npm@latest did the trick

like image 28
Bobbie E. Ray Avatar answered Oct 22 '22 17:10

Bobbie E. Ray


I was able to resolve it by:

npm add --include=dev @electron-forge/cli
npx electron-forge import

update:
replaced --dev with --include=dev as --dev is now deprecated (ref.: comment from @ManuelMB)

like image 27
Sumit Dey Avatar answered Oct 22 '22 16:10

Sumit Dey


Check your NodeJS version (i had an old version and the same issue).

Only fix npm or try to install with npm i -g @electron-forge/cli won't work.

In my case I had to update NodeJS too.

like image 33
Antibug66 Avatar answered Oct 22 '22 16:10

Antibug66