packager icon indicating copy to clipboard operation
packager copied to clipboard

Removing temporary directory on Windows fails with no error

Open MarshallOfSound opened this issue 9 years ago • 18 comments
trafficstars

Running on a Windows Server 2008 build agent the packager fails to generate artifacts with no error

Which version of electron-packager are you using?

Tested on both 7.2.0 and 7.3.0. The exact same config was working a few days ago so perhaps something has changed in the dependency tree?

What CLI arguments are you passing? Alternatively, if you are using the API, what parameters are you passing to the packager() function?

const defaultPackageConf = {
  'app-bundle-id': packageJSON.name,
  'app-category-type': 'public.app-category.healthcare-fitness',
  'app-copyright': `Copyright © ${(new Date()).getFullYear()} ${packageJSON.author.name}, All rights reserved.`, // eslint-disable-line
  'app-version': packageJSON.version,
  arch: 'ia32',
  asar: true,
  'build-version': packageJSON.version,
  dir: '.',
  icon: './build/assets/img/main',
  ignore: ignoreFn,
  name: packageJSON.productName,
  out: './dist/',
  overwrite: true,
  platform: 'win32',
  prune: true,
  tmpdir,
  version,
  'version-string': {
    CompanyName: packageJSON.author.name,
    FileDescription: packageJSON.productName,
    ProductName: packageJSON.productName,
    InternalName: packageJSON.productName,
  },
};

What version of Electron are you building with?

Tried building with Electron 1.2.x and 1.3.x

What is the host platform are you running electron-packager on?

Windows Server 2008, x64

What target platform(s)/architecture(s) are you building for?

Windows x86

Is there a stack trace in the error message you're seeing?

No, there is no error, it just stops. When running with DEBUG enabled the extract-zip module declares itself complete then a second later the process exits with exit code 0.

MarshallOfSound avatar Jul 27 '16 02:07 MarshallOfSound

That is really weird. Can you reproduce this on another (host) operating system?

The exact same config was working a few days ago so perhaps something has changed in the dependency tree?

That seems possible.

malept avatar Jul 27 '16 02:07 malept

@malept It successfully builds on OSX with mono and wine and such installed. It's really strange, no errors, no crashes. The process just dies.

I'm trying to console log my way to the crash now.

MarshallOfSound avatar Jul 27 '16 03:07 MarshallOfSound

@malept Isolated the cause as being 2 different versions of node. It succeeds on node 6.x and fails on node 4.x. This coincides with us dropping a dependency on babel-register.

Has a bit of unsupported ES6 syntax slipped in somewhere?

MarshallOfSound avatar Jul 27 '16 03:07 MarshallOfSound

@MarshallOfSound Shouldn't have. Tests run successfully on Windows x64 (7.3.0 test run). Admittedly there are certain tests which do not run on our Windows CI, but I think they're all Mac related so it wouldn't be relevant to your particular problem.

malept avatar Jul 27 '16 04:07 malept

Out of curiosity, did you test on non-Windows with Node 4.x?

malept avatar Jul 27 '16 04:07 malept

@malept Yep and it failed silently like on the windows agent. Reintroducing babel-register fixed the issue but I'd love to know the root cause

MarshallOfSound avatar Jul 27 '16 04:07 MarshallOfSound

@MarshallOfSound I can't reproduce this with electron-quick-start. Repro instructions (tested on x64 Debian):

  1. nodeenv --prebuilt --node 4.4.7 /tmp/node4 && source /tmp/node4/bin/activate
  2. git clone $electron_quick_start_url && cd electron-quick-start
  3. npm install --save-dev electron-packager
  4. node_modules/.bin/electron-packager --asar --app-version=1.0.0 . --platform=win32 --arch=ia32 --out=dist --overwrite --prune

The folder dist/electron-quick-start-win32-ia32/ exists with what appears to be the correct contents.

malept avatar Jul 27 '16 05:07 malept

@hugolpz That appears to be a completely different issue

MarshallOfSound avatar Aug 01 '16 18:08 MarshallOfSound

(I followed malept steps above and can't reproduce this with electron-quick-start. My apologizes.)

hugolpz avatar Aug 01 '16 18:08 hugolpz

We just ran into this issue where one of our Windows 10 machines would stall with no error or any information like @MarshallOfSound. After some extensive debugging we found that fs-extra was silently failing when trying to remove the tempBase folder.

We cleared out the C:\Users\USERNAME\AppData\Local\Temp folder and it works fine now.

neonhomer avatar Aug 01 '16 18:08 neonhomer

Well that's weird.

CC: @jprichardson

malept avatar Aug 01 '16 18:08 malept

@malept @neonhomer I had the same issue today - no error and no compiling (after having compiled with 1.4.10) - cmd stayed opened. When manually cleaned windows temp dir, installed 1.4.13, cleaned the

C:\Users\<...>\AppData\Local\Temp

it worked.

8.4.0 1.4.13

But at the end of each compilation the cmd wont close and you have to manually clean the above mantioned temp dir - ...\Temp\electron-packager, then the cmd closes. So the bug is not gone.

The 13 number?

englishextra avatar Jan 02 '17 13:01 englishextra

I think I'm getting something akin to this problem on Windows 10 and the latest electron-packager. When I run my script I get the following:

  electron-packager Electron Packager 9.1.0 +0ms
  electron-packager Node v8.5.0 +1ms
  electron-packager Host Operating system: win32 (x64) +0ms
  electron-packager Packager Options: {"appBundleId":"OptimusTime","appCategoryType":"public.app-category.productivity","appCopyright":"Copyright © 2017 A Person, All rights reserved.","appVersion":"2.0.0","arch":"x64","asar":false,"buildVersion":"2.0.0","dir":"C:\\Development\\OptimusTime\\App","icon":"./build/icon.ico","name":"OptimusTime","out":"C:\\Path\\To\\App\\out","overwrite":true,"platform":"win32","protocol":["optimus"],"protocolName":["OptimusTime"],"prune":true,"win32metadata":{"CompanyName":"A Person","FileDescription":"OptimusTime","ProductName":"OptimusTime","InternalName":"OptimusTime"}} +1ms
  electron-packager Target Platforms: win32 +1ms
  electron-packager Target Architectures: x64 +1ms
  electron-packager Inferring target Electron version from electron in C:\Path\To\App\package.json +0ms
  electron-packager Application name: OptimusTime +25ms
  electron-packager Target Electron version: 1.7.6 +0ms
  electron-packager Ignored path regular expressions: [ '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt(-compile)?($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"platform":"win32","arch":"x64","version":"1.7.6"} +0ms
Packaging app for platform win32 x64 using electron v1.7.6
  electron-packager Creating C:\Users\me\AppData\Local\Temp\electron-packager\win32-x64-template +218ms
  electron-packager Extracting C:\Users\me\.electron\electron-v1.7.6-win32-x64.zip to C:\Users\me\AppData\Local\Temp\electron-packager\win32-x64-template +2ms
  electron-packager Initializing app in C:\Users\me\AppData\Local\Temp\electron-packager\win32-x64\OptimusTime-win32-x64 from C:\Users\me\AppData\Local\Temp\electron-packager\win32-x64-template template +2s
  electron-packager Ignored paths based on the out param: [ 'C:\\Path\\To\\App\\out' ] +2s

and then everything just stops before it chucks out an ELIFECYCLE error. I had to delete the Temp directory twice before I managed to get it packaging once. And I've only managed to get it working once today.

ahallicks avatar Sep 19 '17 16:09 ahallicks

@ahallicks When I and others had this issue we saw no errors at all, not the ELIFECYCLE you are seeing. That error normally means node gave up running the script for some reason, potentially out of disk space or out of memory. You might want to check you don't have weird recursive symlinks or something 🤷‍♂️ ?

MarshallOfSound avatar Sep 20 '17 09:09 MarshallOfSound

I had the same problem (cannot delete the .bin folder on temp folder).... very annoying

solution: revert to 7.3.0, and IT WORKED. For the moment I'm not updating to the latest version of packager. 7.3.0 can build properly apps at electron 1.8.2.

ErickRodrCodes avatar Feb 24 '18 09:02 ErickRodrCodes

I don't know why 7.3.0 would be the max version. The only filesystem related change was upgrading fs-extra to 0.28 to 0.30, and that didn't really change anything related to Packager.

malept avatar Feb 24 '18 17:02 malept

I am still having this problem. It doesn't matter if I use electron forge, electron fiddle, electron packager, or electron packager interactive. I have updated node and npm to the ends of the earth and just, nothing. I got electron packager to compile once. It worked the very first time then any other subsequent times it does nothing until I manually terminate the process.

Is there some way to debug this process?

samwhaleIV avatar Feb 23 '19 08:02 samwhaleIV

Hello This problem happened to me as well, using these versions (windows):

  "devDependencies": {
    "electron": "13.2.0",
    "electron-packager": "15.1.0"
  }

and the solution for me was:

  1. In the Task Manager, I closed all programs (that might use TEMP files), and most importantly VScode and Node processes.
  2. Then I go to the windows %temp% folder (Windows+R and then writing %temp% and hitting enter)
  3. Permanently delete everything possible in that folder
  4. Then I deleted the node_modules folder from my project and reinstalled npm i.

When I rebuilt using electron-packager, the problem disappeared and the project is compiled!

elron avatar Sep 13 '21 20:09 elron