Why does electron-builder fail with access denied error?

Viewed 1884

With app tested in VS Code debug environment, the next step to produce Windows installable zip file by executing 'npm run build' fails during download of electron-v9.4.3-win32-x64.zip from github, with access denied error writing to local subfolder Local\electron\Cache. The npm log follows:

> alfatron@1.0.0 build
> electron-builder -w zip

  • electron-builder  version=22.9.1 os=10.0.19041
  • rebuilding native dependencies  dependencies=@serialport/bindings@9.0.4 platform=win32 
    arch=x64
  • install prebuilt binary  name=@serialport/bindings version=9.0.4 platform=win32 arch=x64
  • packaging       platform=win32 arch=x64 electron=9.4.3 appOutDir=dist\win-unpacked
  • downloading     url=https://github.com/electron/electron/releases/download/v9.4.3/electron- 
                    v9.4.3-win32-x64.zip size=70 MB parts=8
  ⨯ open C:\Users\Hugh\AppData\Local\electron\Cache\644580475.zip: Access is denied.
  github.com/develar/go-fs-util.CloseAndCheckError
    C:/Users/develar/go/pkg/mod/github.com/develar/go-fs-util@v0.0.0-20190620175131- 
    69a2d4542206/fs.go:117
  github.com/develar/app-builder/pkg/download.(*Part).download
    Y:/Documents/app-builder/pkg/download/Part.go:57
  github.com/develar/app-builder/pkg/download.(*Downloader).DownloadResolved.func1.1
    Y:/Documents/app-builder/pkg/download/downloader.go:155
  github.com/develar/app-builder/pkg/util.MapAsyncConcurrency.func2
    Y:/Documents/app-builder/pkg/util/async.go:68
  runtime.goexit
          c:/go/src/runtime/asm_amd64.s:1373  
    ⨯ G:\Code Development\AlfatronCameraType1\node_modules\app-builder-bin\win\x64\app- 
        builder.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE  stackTrace=
                                                                                                                                                     
Error: G:\Code Development\AlfatronCameraType1\node_modules\app-builder-bin\win\x64\app-buil 
der.exe exited with code ERR_ELECTRON_BUILDER_CANNOT_EXECUTE
                                                                                                                                                         
at ChildProcess.<anonymous> (G:\Code Development\AlfatronCameraType1\node_modules\builder-util 
\src\util.ts:243:14)
                                                                                                                                                         
at Object.onceWrapper (events.js:422:26)
                                                                                                                                                         
at ChildProcess.emit (events.js:315:20)
                                                                                                                                                         
at maybeClose (internal/child_process.js:1021:16)
                                                                                                                                                         
at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)

The package.json file comprises:

{
 "name": "alfatron",
 "version": "1.0.0",
 "description": "Proof of Concept",
 "main": "main.js",
 "scripts": {
   "start": "electron .",
   "watch": "nodemon --exec electron .",
   "reset": "git reset --hard",
   "build": "electron-builder -w zip"
 },
 "repository": "https://github.com/Hugh-W50/Camera_controller_type_1",
 "keywords": [
   "Electron",
   "Alfatron",
   "prototype"
 ],
 "author": "H Wylie",
 "license": "CC0-1.0",
 "devDependencies": {
   "electron": "^9.4.3",
   "electron-builder": "^22.9.1",
   "nodemon": "^2.0.0"
 },
 "dependencies": {
   "electron-window-state": "^5.0.3",
   "help": "^3.0.2",
   "serialport": "^9.0.4"
 }
}

When examining the folder C:\Users\Hugh\AppData\Local\electron\Cache, it is confirmed that SYSTEM, Admin and user have no access rights restrictions, and each run attempt creates random numeric file name zip parts 1 to 7 prior to the failure; except for parts 1 & 2, these file parts are generally empty, or partly written at the time of failure.

Having launched the command 'npm run build' from various shells with the same outcome, some guidance is needed to overcome this issue.

0 Answers
Related