electron/packager

packager stops without any messages on a Windows host platform

ZoolWay opened this issue · 45 comments

When I try to package my simple application ( https://github.com/ZoolWay/electron-typescript-aurelia-starter ) I run:

D:\Daten\Tech Files\Development\electron-typescript-aurelia-starter>electron-packager . --platform=win32 --arch=x64
  electron-packager Electron Packager 8.3.0 +0ms
  electron-packager Node v6.6.0 +0ms
  electron-packager Host Operating system: win32 (x64) +0ms
  electron-packager Packager Options: {"_":["."],"all":false,"deref-symlinks":true,"download":{"strictSSL":true},"overwrite":false,"prune":true,"platform":"win32","arch":"x64","dir":".","protocols":[]} +0ms
  electron-packager Target Platforms: win32 +0ms
  electron-packager Target Architectures: x64 +0ms
  electron-packager Inferring application name from name in D:\Daten\Tech Files\Development\electron-typescript-aurelia-starter\package.json +15ms
  electron-packager Inferring app-version from version in D:\Daten\Tech Files\Development\electron-typescript-aurelia-starter\package.json +0ms
  electron-packager Inferring target Electron version from electron-prebuilt in D:\Daten\Tech Files\Development\electron-typescript-aurelia-starter\package.json +0ms
  electron-packager Application name: electron-typescript-aurelia-starter +0ms
  electron-packager Target Electron version: 1.4.10 +0ms
  electron-packager Ignored path regular expressions: [ '/node_modules/electron($|/)',
  '/node_modules/electron-prebuilt($|/)',
  '/node_modules/electron-packager($|/)',
  '/\\.git($|/)',
  '/node_modules/\\.bin($|/)',
  '\\.o(bj)?$' ] +0ms
  electron-packager Downloading Electron with options {"strictSSL":true,"platform":"win32","arch":"x64","version":"1.4.10"} +6s
Packaging app for platform win32 x64 using electron v1.4.10
  electron-packager Creating C:\Users\ZoolWay\AppData\Local\Temp\electron-packager\win32-x64-template +243ms
  electron-packager Extracting C:\Users\ZoolWay\.electron\electron-v1.4.10-win32-x64.zip to C:\Users\ZoolWay\AppData\Local\Temp\electron-packager\win32-x64-template +4ms
  electron-packager Initializing app in C:\Users\ZoolWay\AppData\Local\Temp\electron-packager\win32-x64\electron-typescript-aurelia-starter-win32-x64 from C:\Users\ZoolWay\AppData\Local\Temp\electron-packager\win32-x64-template template +1s
  electron-packager Ignored paths based on the out param: [ 'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-darwin-ia32',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-darwin-x64',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-darwin-armv7l',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-linux-ia32',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-linux-x64',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-linux-armv7l',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-mas-ia32',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-mas-x64',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-mas-armv7l',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-win32-ia32',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-win32-x64',
  'D:\\Daten\\Tech Files\\Development\\electron-typescript-aurelia-starter\\electron-typescript-aurelia-starter-win32-armv7l' ] +17ms

Then it finishes without anything else to say. I am back at my console shell, no output generated.

As you see I call it like this:

electron-packager . --platform=win32 --arch=x64

The pure electron-quick-start works but not with this project of myself. Most confusing is exiting without any error message.

Hrm. Try setting DEBUG=*and then pasting the Electron Packager output in a gist (because that's the ultra verbose setting).

Thanks @malept , did not know about DEBUG=*.

Here is the gist: https://gist.github.com/ZoolWay/bee85209aacc45e4114de155b78919f5

To me looks like it is just stopping in the middle of things.

That is extremely strange. The last two debug lines should be flipped, for one.

It looks like your temporary directory is on a different drive than your app's working directory. Could you try having your working directory on the same drive as your temporary directory? (It shouldn't matter, but I have a bad feeling about this.)

I updated the gist using the tmpdir option to use D:\tmp - so everything should be on drive D:. No success.

Also I moved the folder directly under D:\ to have no space in the path and a shorter name. Still no success.

I still think this is Windows-specific. Is it possible to try with a different host platform? (keep the target the same)

I have now tried a different machine but I only got Win 10 machines here. The same result.

Also note that the same command line works for the electron-quickstart project (cloned, npm installed, packaged) - so I am not sure.

Failing the packaging without any error, thats really strange.

I might be able to test it in a Linux VM but not before Sunday. But you could try with my repo by yourself if you got a minute to spare ( https://github.com/ZoolWay/electron-typescript-aurelia-starter ).

Otherwise I will come back after a Linux test. Let me know if I can try something else or make it more verbose in any way.

Ok, found an old VM with Ubuntu and installed nodejs, etc. plus wine.

Building the linux package works and building the win32-x86 package works there too. I updated the gist with the log (DEBUG=*) from the latter in case it helps.

Fair warning, since this appears to be a Windows-specific issue, it may be a while before I find the time to boot up a Windows VM and debug this.

If you would to try debugging this yourself, this is what I'm going to do: put a bunch of debug statements in the initializeApp and win32 code and see which function call it runs before it stops.

Interestingly, this also fails using https://github.com/Microsoft/BashOnWindows

Yeah, I imagine it's Windows-internals-specific.

I still haven't found time to debug this and would appreciate someone else who's motivated to follow the instructions in my earlier comment and post the results here.

> gamempire@1.0.0 package C:\Users\Jiaqin Meng\GamempireApp\client
> electron-packager ./ Gamempire --overwrite --app-version=1.0.0 --platform=win32 --arch=all --out=../demo --version=electronVersion

The version parameter is deprecated, use electronVersion instead
Packaging app for platform win32 ia32 using electron v1.4.13`

then it is crashed for no reason and no error log appears.i am looking for a solution to package

@mmmmeng3

--version=electronVersion

That's not what that deprecation message means. Use --electron-version instead of --version. This will be clearer in the next release.

I still need a volunteer to debug this.

i dont know if this help. i add flag with --ignore=node_,modules. it solves all my problem.

I tried --ignore=node_modules too and at least I get a package now. Have to verify if the others errors are mine or by packager.

It would really help if someone could make a minimal testcase that reproduces the problem. Using the electron-quick-start repository as a base, could someone please create a minimal Electron app that illustrates this issue, and post a link to it here? The repository linked in the issue summary has far too many dependencies to figure out which in the dependency tree might be causing this.

@malept

I cloned electron-quick-start on windows 10 desktop.

https://github.com/electron/electron-quick-start

Then in cmd:

npm install
C:\Users\serguei\Desktop\electron-quick-start>npm install

> electron@1.4.15 postinstall C:\Users\serguei\Desktop\electron-quick-start\node_modules\electron
> node install.js

electron-quick-start@1.0.0 C:\Users\serguei\Desktop\electron-quick-start
`-- electron@1.4.15
  +-- electron-download@3.2.0
  | +-- debug@2.6.0
  | | `-- ms@0.7.2
  | +-- fs-extra@0.30.0
  | | +-- graceful-fs@4.1.11
  | | +-- jsonfile@2.4.0
  | | +-- klaw@1.3.1
  | | +-- path-is-absolute@1.0.1
  | | `-- rimraf@2.5.4
  | |   `-- glob@7.1.1
  | |     +-- fs.realpath@1.0.0
  | |     +-- inflight@1.0.6
  | |     | `-- wrappy@1.0.2
  | |     +-- minimatch@3.0.3
  | |     | `-- brace-expansion@1.1.6
  | |     |   +-- balanced-match@0.4.2
  | |     |   `-- concat-map@0.0.1
  | |     `-- once@1.4.0
  | +-- home-path@1.0.3
  | +-- minimist@1.2.0
  | +-- nugget@2.0.1
  | | +-- pretty-bytes@1.0.4
  | | | +-- get-stdin@4.0.1
  | | | `-- meow@3.7.0
  | | |   +-- camelcase-keys@2.1.0
  | | |   | `-- camelcase@2.1.1
  | | |   +-- decamelize@1.2.0
  | | |   +-- loud-rejection@1.6.0
  | | |   | +-- currently-unhandled@0.4.1
  | | |   | | `-- array-find-index@1.0.2
  | | |   | `-- signal-exit@3.0.2
  | | |   +-- map-obj@1.0.1
  | | |   +-- normalize-package-data@2.3.5
  | | |   | +-- hosted-git-info@2.1.5
  | | |   | +-- is-builtin-module@1.0.0
  | | |   | | `-- builtin-modules@1.1.1
  | | |   | `-- validate-npm-package-license@3.0.1
  | | |   |   +-- spdx-correct@1.0.2
  | | |   |   | `-- spdx-license-ids@1.2.2
  | | |   |   `-- spdx-expression-parse@1.0.4
  | | |   +-- object-assign@4.1.1
  | | |   +-- read-pkg-up@1.0.1
  | | |   | +-- find-up@1.1.2
  | | |   | `-- read-pkg@1.1.0
  | | |   |   +-- load-json-file@1.1.0
  | | |   |   | +-- parse-json@2.2.0
  | | |   |   | | `-- error-ex@1.3.0
  | | |   |   | |   `-- is-arrayish@0.2.1
  | | |   |   | +-- pify@2.3.0
  | | |   |   | `-- strip-bom@2.0.0
  | | |   |   |   `-- is-utf8@0.2.1
  | | |   |   `-- path-type@1.1.0
  | | |   +-- redent@1.0.0
  | | |   | +-- indent-string@2.1.0
  | | |   | | `-- repeating@2.0.1
  | | |   | |   `-- is-finite@1.0.2
  | | |   | `-- strip-indent@1.0.1
  | | |   `-- trim-newlines@1.0.0
  | | +-- progress-stream@1.2.0
  | | | +-- speedometer@0.1.4
  | | | `-- through2@0.2.3
  | | |   +-- readable-stream@1.1.14
  | | |   | `-- isarray@0.0.1
  | | |   `-- xtend@2.1.2
  | | |     `-- object-keys@0.4.0
  | | +-- request@2.79.0
  | | | +-- aws-sign2@0.6.0
  | | | +-- aws4@1.5.0
  | | | +-- caseless@0.11.0
  | | | +-- combined-stream@1.0.5
  | | | | `-- delayed-stream@1.0.0
  | | | +-- extend@3.0.0
  | | | +-- forever-agent@0.6.1
  | | | +-- form-data@2.1.2
  | | | | `-- asynckit@0.4.0
  | | | +-- har-validator@2.0.6
  | | | | +-- chalk@1.1.3
  | | | | | +-- ansi-styles@2.2.1
  | | | | | +-- escape-string-regexp@1.0.5
  | | | | | +-- has-ansi@2.0.0
  | | | | | `-- supports-color@2.0.0
  | | | | +-- commander@2.9.0
  | | | | | `-- graceful-readlink@1.0.1
  | | | | `-- is-my-json-valid@2.15.0
  | | | |   +-- generate-function@2.0.0
  | | | |   +-- generate-object-property@1.2.0
  | | | |   | `-- is-property@1.0.2
  | | | |   +-- jsonpointer@4.0.1
  | | | |   `-- xtend@4.0.1
  | | | +-- hawk@3.1.3
  | | | | +-- boom@2.10.1
  | | | | +-- cryptiles@2.0.5
  | | | | +-- hoek@2.16.3
  | | | | `-- sntp@1.0.9
  | | | +-- http-signature@1.1.1
  | | | | +-- assert-plus@0.2.0
  | | | | +-- jsprim@1.3.1
  | | | | | +-- extsprintf@1.0.2
  | | | | | +-- json-schema@0.2.3
  | | | | | `-- verror@1.3.6
  | | | | `-- sshpk@1.10.2
  | | | |   +-- asn1@0.2.3
  | | | |   +-- assert-plus@1.0.0
  | | | |   +-- bcrypt-pbkdf@1.0.0
  | | | |   +-- dashdash@1.14.1
  | | | |   | `-- assert-plus@1.0.0
  | | | |   +-- ecc-jsbn@0.1.1
  | | | |   +-- getpass@0.1.6
  | | | |   | `-- assert-plus@1.0.0
  | | | |   +-- jodid25519@1.0.2
  | | | |   +-- jsbn@0.1.0
  | | | |   `-- tweetnacl@0.14.5
  | | | +-- is-typedarray@1.0.0
  | | | +-- isstream@0.1.2
  | | | +-- json-stringify-safe@5.0.1
  | | | +-- mime-types@2.1.14
  | | | | `-- mime-db@1.26.0
  | | | +-- oauth-sign@0.8.2
  | | | +-- qs@6.3.0
  | | | +-- stringstream@0.0.5
  | | | +-- tough-cookie@2.3.2
  | | | | `-- punycode@1.4.1
  | | | +-- tunnel-agent@0.4.3
  | | | `-- uuid@3.0.1
  | | +-- single-line-log@1.1.2
  | | | `-- string-width@1.0.2
  | | |   +-- code-point-at@1.1.0
  | | |   +-- is-fullwidth-code-point@1.0.0
  | | |   | `-- number-is-nan@1.0.1
  | | |   `-- strip-ansi@3.0.1
  | | |     `-- ansi-regex@2.1.1
  | | `-- throttleit@0.0.2
  | +-- path-exists@2.1.0
  | | `-- pinkie-promise@2.0.1
  | |   `-- pinkie@2.0.4
  | +-- rc@1.1.6
  | | +-- deep-extend@0.4.1
  | | +-- ini@1.3.4
  | | `-- strip-json-comments@1.0.4
  | +-- semver@5.3.0
  | `-- sumchecker@1.3.0
  |   `-- es6-promise@4.0.5
  `-- extract-zip@1.6.0
    +-- concat-stream@1.5.0
    | +-- inherits@2.0.3
    | +-- readable-stream@2.0.6
    | | +-- core-util-is@1.0.2
    | | +-- isarray@1.0.0
    | | +-- process-nextick-args@1.0.7
    | | +-- string_decoder@0.10.31
    | | `-- util-deprecate@1.0.2
    | `-- typedarray@0.0.6
    +-- debug@0.7.4
    +-- mkdirp@0.5.0
    | `-- minimist@0.0.8
    `-- yauzl@2.4.1
      `-- fd-slicer@1.0.1
        `-- pend@1.2.0


C:\Users\serguei\Desktop\electron-quick-start>
npm start

2017-01-20_223839

@englishextra that doesn't actually reproduce the problem. You need to modify electron-quick-start to be packageable.

@malept I was not going to reproduce the problem. I just confirmed that quick start works and placed the log of cmd for you to see the deps so that you can have the picture. The case is particular so the dev only knows where to dig into.

I am experiencing the same problem on Windows 10 64 bit. Packaging the same project works fine on OSX.

Here is my log: https://gist.github.com/arekkas/bee174bac37357a8910f48693fd5a1b7

To be clear to future commenters: this only affects Windows.

@arekkas thank you for the log.

This confirms my suspicion from my earlier comment. Someone who has this problem, please try the following: put a bunch of debug statements in the initializeApp function (inside common.js) and win32.js file and see which function call it runs before it stops.

My suspicion is a long path issue in one of the node modules. Nothing concrete yet though.

@malept so apparently we make it past the last statement in common.js:

initializeApp()
// ...
    series(operations, function (err) {
      console.log('cb err', err) // this is never being called
      if (err) return callback(err)
      callback(null, tempPath)
    })
    console.log('end') // this gets executed
  },

but we're not making it in the callback in win32.js:

  createApp: function createApp (opts, templatePath, callback) {
    common.initializeApp(opts, templatePath, path.join('resources', 'app'), function buildWinApp (err, tempPath) {
      console.log('init cb') // we don't make it until here

I've tried this hack to debug which operation is causing the trouble, it seems like it's operation 1:

    series(operations.map((o, k) => (args) => {
      console.log('operation', k) // prints "operation 0", "operation 1"
      return o(args)
    }), function (err) {
      if (err) return callback(err)
      callback(null, tempPath)
    })

@arekkas, I appreciate you taking the time to look at this. This is the first operation. This is the second. I take it you're saying it's the second (because 0-based indexes)?

@malept yes, it's the second. although it seems that we're finishing that one too. my guess is that fs.copy is not calling the callback. I tried wrapping it in a try/catch block which doesn't say anything either. I'm currently investigating if it's a path issue or something.

ok, now it threw an error:

EPERM: operation not permitted, open 'D:\Temp\electron-packager\win32-x64\ORY Sites App-win32-x64\resources\app\.git\objects\05\f8aed8fed644d5c291c1a73b90366152964b24'

Ah, scrap my last comment. It was caused by me removing the options from fs.copy(opts.dir, appPath, {filter: ignore.userIgnoreFilter(opts), dereference: shouldDeref}, cb): fs.copy(opts.dir, appPath, cb). When I add it, same thing happens (it just quits) without any notice.

Could this be the cause?

@arekkas Nope, I haven't even released that yet 😄

Ok, damnit. :D

So I just tried this:

        try {
          fs.copy(opts.dir, appPath, {filter: ignore.userIgnoreFilter(opts), dereference: shouldDeref}, () => {
            console.log('GOT CALLED BACK')
          })
        } catch (e) {
          console.error(e)
        }

which yields...nothing. So I guess it's something with the copy task that doesn't call the callback properly.

@arekkas just for completeness's sake, could you try with Electron Packager master? I want to make sure it's still a problem in the latest fs-extra before I go asking that you escalate this to the upstream module's issue tracker.

how does that work, npm i electron-packager@master?

I investigated if the issue is with spaces in the path (D:\Temp\electron-packager\win32-x64\ORY Sites App-win32-x64\resources\app) but it's not. I used the electron template with the same name and packaging that worked. One more indicator that this could be a long filename issue (it's in fs.copy, it's not reproducible with the boilerplate app, it's not the tmp path)

I think you can just say npm install $GIT_URL.

Adding "electron-packager": "git+https://github.com/electron-userland/electron-packager.git", in the package.json did the trick. :)

Unfortunately, the issue persists on the master branch.

upstream: jprichardson/node-fs-extra#358

Let's see what they say.

@arekkas thanks for filing the issue, it is greatly appreciated.

Thank you for being so responsive, not a lot of maintainers are!

Try upgrading to node 7.6.0. It seems to be working with that one!

Any leads on this one? I'm stuck with the same issue for one of my projects. But my another project for win32 is completing without any issue.

Evidently, try the latest Node 7.

I updated to Node 7.7.2 and it is now working as expected. Now that's a relief.

Thanks!

I'm going to close this, since there's a workaround and it appears to be a Node problem, not an Electron Packager problem.

C0ZEN commented

I don't know why but --ignore=node_modules fixed my problem, thanks to @mmmmeng3.
Without it, the only thing I get from the run was :

Packaging app for platform win32 x64 using electron v1.6.8.

With it :

Packaging app for platform win32 x64 using electron v1.6.8
Wrote new app to release-app\cogeo-app-win32-x64

Adding --ignore=node_modules fixed my build issue, though I needed a package in there.
Deleting my node_modules folder and then reinstalling with npm i fixed my problems.