menu

JS Everywhere

A community for the JavaScript Everywhere book by Adam Scott, published by O'Reilly.

Channels
Team

Chp 20: have error when build for Windows

July 6, 2020 at 12:20am

Chp 20: have error when build for Windows

July 6, 2020 at 12:20am
In package.json, I have the following:
"scripts": { "start": "electron src/index.js", "final": "electron final/index.js", "pack": "electron-builder --dir", "dist": "electron-builder -ml" }, "build": { "appId": "com.thebestme.notedly", "productName": "Notedly", "directories": { "buildResources": "resources" } },
when run "rpm run dist", if it is mwl, it will show the following error:
Exit code: ENOENT. spawn prlctl ENOENT stackTrace= Error: Exit code: ENOENT. spawn prlctl ENOENT at /Users/woravitk/Documents/web/javascript_course/JavascriptEverywhere/desktop/node_modules/builder-util/src/util.ts:125:16 at exithandler (child_process.js:302:5) at ChildProcess.errorhandler (child_process.js:314:5) at ChildProcess.emit (events.js:223:5) at Process.ChildProcess._handle.onexit (internal/child_process.js:270:12) at onErrorNT (internal/child_process.js:456:16) at processTicksAndRejections (internal/process/task_queues.js:81:21) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] dist: electron-builder -mwl npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] dist script.

July 6, 2020 at 12:24am
the content of the log file is:
cat 2020-07-06T00_11_05_051Z-debug.log 0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'dist' ] 2 info using [email protected] 3 info using [email protected] 4 verbose run-script [ 'predist', 'dist', 'postdist' ] 5 info lifecycle [email protected]~predist: [email protected] 6 info lifecycle [email protected]~dist: [email protected] 7 verbose lifecycle [email protected]~dist: unsafe-perm in lifecycle true 8 verbose lifecycle [email protected]~dist: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/woravitk/Documents/web/javascript_course/JavascriptEverywhere/desktop/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin 9 verbose lifecycle [email protected]~dist: CWD: /Users/woravitk/Documents/web/javascript_course/JavascriptEverywhere/desktop 10 silly lifecycle [email protected]~dist: Args: [ '-c', 'electron-builder -mwl' ] 11 silly lifecycle [email protected]~dist: Returned: code: 1 signal: null 12 info lifecycle [email protected]~dist: Failed to exec dist script 13 verbose stack Error: [email protected] dist: electron-builder -mwl 13 verbose stack Exit status 1 13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:332:16) 13 verbose stack at EventEmitter.emit (events.js:223:5) 13 verbose stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14) 13 verbose stack at ChildProcess.emit (events.js:223:5) 13 verbose stack at maybeClose (internal/child_process.js:1021:16) 13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5) 14 verbose pkgid [email protected] 15 verbose cwd /Users/woravitk/Documents/web/javascript_course/JavascriptEverywhere/desktop 16 verbose Darwin 19.5.0 17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist" 18 verbose node v12.14.1 19 verbose npm v6.14.5 20 error code ELIFECYCLE 21 error errno 1 22 error [email protected] dist: electron-builder -mwl 22 error Exit status 1 23 error Failed at the [email protected] dist script. 23 error This is probably not a problem with npm. There is likely additional logging output above. 24 verbose exit [ 1, true ]
  • reply
  • like
when not target the windows platform, it works just fine.
I try remove mac and linux and target only on Windows and the same error still occur.
  • reply
  • like

July 6, 2020 at 11:38am
Hi here is electron-builder's documentation for targeting Windows: https://www.electron.build/configuration/win#WindowsConfiguration-target
  • reply
  • like
I think that the configuration should be (replace nsis):
"build": {
"win": {
"target": [
{
"target": "nsis",
"arch": [
"x64",
"ia32"
]
}
]
}
}
and the build command:
build -wl
  • reply
  • like
Let me know if you still run into errors, I don't have a Windows machine handy to test this on
like-fill
1
  • reply
  • like
Hello, I forget to mention that I use Mac as developing machine and I try to build the Notedly on all platform (from my mac). For Mac and Linux, everything is just fine. For windows it has that error. However, in the dist folder, there are files for Windows liked Notedly Setup 0.1.0.exe.
  • reply
  • like
Anyway, I will read the document first and may try again later.
  • reply
  • like
Thank you very much for you reply.
  • reply
  • like
Happy to help! Let me know if you run into any further issues
  • reply
  • like
Thanks.
I am not sure if this is it but it is working now. After google for the solution, I find one article state that the electron builder should be version 22. So, I change in package.json to "electron-builder": "22" and it works now.
  • reply
  • like

July 11, 2020 at 11:48am
👍
  • reply
  • like