Electron-builder: Not all files in /app are packaged

Created on 11 Aug 2017  Â·  10Comments  Â·  Source: electron-userland/electron-builder

  • Version: 19.20.1
  • Target: win

This is my app folder that should be being packaged:

/root/app
image

/root/app/dist
image

When I turn off asar packaging, and run the command build --win --x64 --ia32 --dir, it appears that not all files are packaged up. This is what the dist directory looks like:

/root/dist/win-unpacked/resources/app
image

So basically, it's missing the dist folder.

Has something changed in electron-builder since v18.6.2 that may have caused this? Up until recently, this hasn't seemed to be a problem.

There's nothing crazy going on in the development/project package.json as far as I'm concerned, but here are the relevant parts in any case:

"build": {
  "appId": "myapp",
  "asar": false, 
  "artifactName": "${name}_${os}_${arch}-setup.${ext}",
  "mac": {
    "category": "public.app-category.business"
  },
  "nsis": {},
  "publish": [
    {
      "provider": "generic",
      "url": "http://myapp.com/downloads"
    }
  ]
}
bug

Most helpful comment

Bug: !dist{,/**/*} is added, but it is incorrect in case of "Two package.json structure is used".

All 10 comments

As a workaround, if I add "files": ["**/*", "dist/**/*"] to the package.json, the dist folder is correctly packaged. I'm guessing this shouldn't be necessary though...?

dist it is output directory by default and, so, excluded. Please see options https://github.com/electron-userland/electron-builder/wiki/Options and configure directories.output to another value.

So it excludes any subfolder in the output directory that matches the output directory's name? This seems nonsensical, is undocumented and should be considered a bug in my opinion.

So it excludes any subfolder in the output directory that matches the output directory's name?

Any if such subfolder is not specified in the files.

should be considered a bug in my opinion.

No magic here. No way to check is some artifact part of your app or result of build. So, output directory is excluded but you still able to override it — add subfolder to files if need. Or just set directories.output to another value.

Shouldn't everything in the application directory be the result of the build and be packaged up though? I suppose I just don't see why anything inside app (or whatever the application directory is set to in options) would be excluded for any reason. The only thing that this exclusion would help with is if someone was silly enough to set their output folder to be _inside_ the application directory.

Either way, I'm glad to have a workaround I can use. Thanks for your consideration of this in any case :)

if someone was silly enough to set their output folder to be inside the application directory

Please set env DEBUG=electron-builder and attach log of the terminal output.

Perhaps there's some miscommunication here due to confusion with the directory structure. Here are all the relevant directories after the app has been built and packaged in one image that should make it easier to understand:

untitled

Here's the debug log you requested:

yarn package-win
yarn package-win v0.27.5
$ cross-env DEBUG=electron-builder build --win --x64 --ia32 --dir
electron-builder 19.20.1
  electron-builder Effective config:
  electron-builder appId: myapp
  electron-builder artifactName: '${name}_${os}_${arch}-setup.${ext}'
  electron-builder mac:
  electron-builder   category: public.app-category.business
  electron-builder nsis: {}
  electron-builder publish:
  electron-builder   - provider: generic
  electron-builder     url: 'http://static.myapp.com/downloads'
  electron-builder files:
  electron-builder   - '**/*'
  electron-builder   - dist/**/*
  electron-builder  +0ms
  electron-builder Two package.json structure is used (dev: D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\package.json, app: D:\Users\Andrew\Dropbox\Work\myapp\code
\Talent\app\package.json) +670ms
Installing app dependencies for arch x64 to D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\app
  electron-builder Spawning C:\Program Files\nodejs\node.exe C:\Program Files (x86)\Yarn\bin\yarn.js install --production +154ms
███░ 3/4  electron-builder C:\Program Files\nodejs\node.exe (64072) exited with exit code 0 +2s
Packaging for win32 x64 using electron 1.7.6 to dist\win-unpacked
  electron-builder Spawning D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\node_modules\7zip-bin-win\x64\7za.exe x -bd C:\Users\Andrew\AppData\Local\electron\Cache\electron-v1.
7.6-win32-x64.zip -oD:\Users\Andrew\Dropbox\Work\myapp\code\Talent\dist\win-unpacked +5s

7-Zip (a) 17.00 beta (x64) : Copyright (c) 1999-2017 Igor Pavlov : 2017-04-29

Scanning the drive for archives:
1 file, 53897098 bytes (52 MiB)

Extracting archive: C:\Users\Andrew\AppData\Local\electron\Cache\electron-v1.7.6-win32-x64.zip
--
Path = C:\Users\Andrew\AppData\Local\electron\Cache\electron-v1.7.6-win32-x64.zip
Type = zip
Physical Size = 53897098

Everything is Ok

Files: 117
Size:       138472204
Compressed: 53897098
  electron-builder D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\node_modules\7zip-bin-win\x64\7za.exe (65272) exited with exit code 0 +6s
  electron-builder File patterns of first/default matcher:
  electron-builder      **/*
  electron-builder      node_modules/**/*
  electron-builder      !dist{,/**/*}
  electron-builder      dist/**/*
  electron-builder      package.json
  electron-builder      !**/node_modules/*/{README.md,karma.conf.js,.coveralls.yml,readme.markdown,README,readme.md,readme,test,__tests__,tests,powered-test,example,examples}
  electron-builder      !**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj,cc,obj,pdb,h}
  electron-builder      !**/._*
  electron-builder      !**/electron-builder.{yaml,yml,json,json5,toml}
  electron-builder      !**/{.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,.DS_Store,thumbs.db,.gitignore,.gitkeep,.gitattributes,.npmignore,.idea,.vs,.editorconfig,.flowconfig,.jshintrc,.eslint
rc,.yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log,appveyor.yml,.travis.yml,circle.yml,.nyc_output} +203ms
  electron-builder Production dependencies in the D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\app: minimist, mkdirp +518ms
  electron-builder Executing C:\Users\Andrew\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.9.0\rcedit.exe D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\dist\w
in-unpacked\myapp.exe --set-version-string FileDescription myapp --set-version-string ProductName myapp --set-version-string LegalCopyright Copyright © 2017
Andrew Beaven --set-file-version 0.1.0 --set-product-version 0.1.0.0 --set-version-string InternalName myapp --set-version-string OriginalFilename  --set-version-string CompanyN
ame Andrew Beaven --set-icon D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\build\icon.ico +2s
wine&sign: 0s 952.805055ms
No native production dependencies
Packaging for win32 ia32 using electron 1.7.6 to dist\win-ia32-unpacked
  electron-builder Spawning D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\node_modules\7zip-bin-win\x64\7za.exe x -bd C:\Users\Andrew\AppData\Local\electron\Cache\electron-v1.
7.6-win32-ia32.zip -oD:\Users\Andrew\Dropbox\Work\myapp\code\Talent\dist\win-ia32-unpacked +1s

7-Zip (a) 17.00 beta (x64) : Copyright (c) 1999-2017 Igor Pavlov : 2017-04-29

Scanning the drive for archives:
1 file, 44440167 bytes (43 MiB)

Extracting archive: C:\Users\Andrew\AppData\Local\electron\Cache\electron-v1.7.6-win32-ia32.zip
--
Path = C:\Users\Andrew\AppData\Local\electron\Cache\electron-v1.7.6-win32-ia32.zip
Type = zip
Physical Size = 44440167

Everything is Ok

Files: 117
Size:       107309412
Compressed: 44440167
  electron-builder D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\node_modules\7zip-bin-win\x64\7za.exe (57456) exited with exit code 0 +5s
  electron-builder File patterns of first/default matcher:
  electron-builder      **/*
  electron-builder      node_modules/**/*
  electron-builder      !dist{,/**/*}
  electron-builder      dist/**/*
  electron-builder      package.json
  electron-builder      !**/node_modules/*/{README.md,karma.conf.js,.coveralls.yml,readme.markdown,README,readme.md,readme,test,__tests__,tests,powered-test,example,examples}
  electron-builder      !**/*.{iml,o,hprof,orig,pyc,pyo,rbc,swp,csproj,sln,xproj,cc,obj,pdb,h}
  electron-builder      !**/._*
  electron-builder      !**/electron-builder.{yaml,yml,json,json5,toml}
  electron-builder      !**/{.git,.hg,.svn,CVS,RCS,SCCS,__pycache__,.DS_Store,thumbs.db,.gitignore,.gitkeep,.gitattributes,.npmignore,.idea,.vs,.editorconfig,.flowconfig,.jshintrc,.eslint
rc,.yarn-integrity,.yarn-metadata.json,yarn-error.log,yarn.lock,package-lock.json,npm-debug.log,appveyor.yml,.travis.yml,circle.yml,.nyc_output} +3ms
  electron-builder Production dependencies in the D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\app: minimist, mkdirp +9ms
  electron-builder Executing C:\Users\Andrew\AppData\Local\electron-builder\cache\winCodeSign\winCodeSign-1.9.0\rcedit.exe D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\dist\w
in-ia32-unpacked\myapp.exe --set-version-string FileDescription myapp --set-version-string ProductName myapp --set-version-string LegalCopyright Copyright ©
2017 Andrew Beaven --set-file-version 0.1.0 --set-product-version 0.1.0.0 --set-version-string InternalName myapp --set-version-string OriginalFilename  --set-version-string Com
panyName Andrew Beaven --set-icon D:\Users\Andrew\Dropbox\Work\myapp\code\Talent\build\icon.ico +199ms
wine&sign: 0s 702.224386ms
Done in 29.28s.

Bug: !dist{,/**/*} is added, but it is incorrect in case of "Two package.json structure is used".

As of version 20.18.0, this still seems to be a problem. Is there any reason the problem hasn't been fixed? Or has it been fixed in a more recent version and the issue accidentally left open?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

omarkilani picture omarkilani  Â·  3Comments

alexstrat picture alexstrat  Â·  3Comments

AidanNichol picture AidanNichol  Â·  3Comments

mstralka picture mstralka  Â·  3Comments

noahprince22 picture noahprince22  Â·  3Comments