electron / packager

Customize and package your Electron app with OS-specific bundles (.app, .exe, etc.) via JS or CLI
https://npm.im/@electron/packager
BSD 2-Clause "Simplified" License
162 stars 17 forks source link

Removing temporary directory on Windows fails with no error #431

Open MarshallOfSound opened 8 years ago

MarshallOfSound commented 8 years ago

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.

malept commented 8 years ago

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.

MarshallOfSound commented 8 years ago

@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 commented 8 years ago

@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?

malept commented 8 years ago

@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 commented 8 years ago

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

MarshallOfSound commented 8 years ago

@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

malept commented 8 years ago

@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.

MarshallOfSound commented 8 years ago

@hugolpz That appears to be a completely different issue

hugolpz commented 8 years ago

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

neonhomer commented 8 years ago

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.

malept commented 8 years ago

Well that's weird.

CC: @jprichardson

englishextra commented 7 years ago

@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?

ahallicks commented 7 years ago

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.

MarshallOfSound commented 7 years ago

@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 🤷‍♂️ ?

ErickRodrCodes commented 6 years ago

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.

malept commented 6 years ago

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.

samwhaleIV commented 5 years ago

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?

elron commented 3 years ago

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!