electron-userland / electron-builder

A complete solution to package and build a ready for distribution Electron app with “auto update” support out of the box
https://www.electron.build
MIT License
13.7k stars 1.74k forks source link

Error packaging app on Linux #309

Closed maxcnunes closed 8 years ago

maxcnunes commented 8 years ago

I got this error on building an app on Linux:

npm info ok
Packaging app for platform linux x64 using electron v0.37.5
{:timestamp=>"2016-04-13T01:12:18.632742+0000", :message=>"Debian tools (dpkg/apt) don't do well with packages that use capital letters in the name. In some cases it will automatically downcase them, in others it will not. It is confusing. Best to not use any capital letters at all. I have downcased the package name for you just to be safe.", :oldname=>"Sqlectron", :fixedname=>"sqlectron", :level=>:warn}
{:timestamp=>"2016-04-13T01:12:18.662876+0000", :message=>"Debian packaging tools generally labels all files in /etc as config files, as mandated by policy, so fpm defaults to this behavior for deb packages. You can disable this default behavior with --deb-no-default-config-files flag", :level=>:warn}
{:timestamp=>"2016-04-13T01:12:21.613931+0000", :message=>"Process failed: tar failed (exit code 13). Full command was:[\"tar\", \"-C\", \"/usr/src/app/.tmp/package-dir-staging20160413-4387-1fsv2z\", \"-J\", \"--numeric-owner\", \"--owner\", \"0\", \"--numeric-owner\", \"--group\", \"0\", \"-cf\", \"/usr/src/app/.tmp/package-deb-build20160413-4387-1v04izh/data.tar.xz\", \".\"]", :level=>:error}

Error: Command failed: fpm -s dir -t deb --architecture amd64 --rpm-os linux --name Sqlectron --force --after-install /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/after-install --after-remove /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/after-remove --description A simple and lightweight SQL client with cross database and platform support --maintainer The Sqlectron Team <maxcnunes@gmail.com> --version 1.5.0 --package /usr/src/app/dist/Sqlectron-1.5.0-amd64.deb --deb-compression xz --url https://github.com/sqlectron/sqlectron-gui --license MIT /usr/src/app/dist/Sqlectron-linux-x64/=/opt/Sqlectron /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_16x16x32.png=/usr/share/icons/hicolor/16x16/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_24x24x32.png=/usr/share/icons/hicolor/24x24/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_32x32x32.png=/usr/share/icons/hicolor/32x32/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_48x48x32.png=/usr/share/icons/hicolor/48x48/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_64x64x32.png=/usr/share/icons/hicolor/64x64/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_96x96x32.png=/usr/share/icons/hicolor/96x96/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_128x128x32.png=/usr/share/icons/hicolor/128x128/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_256x256x32.png=/usr/share/icons/hicolor/256x256/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/icon_512x512x32.png=/usr/share/icons/hicolor/512x512/apps/Sqlectron.png /usr/src/app/.tmp/electron-builder-430846YuiTr1YBFV/Sqlectron.desktop=/usr/share/applications/Sqlectron.desktop

    at ChildProcess.exithandler (child_process.js:213:12)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
From previous event:
    at Object.exec (/usr/src/app/node_modules/electron-builder/src/util.ts:72:10)
    at LinuxPackager.<anonymous> (/usr/src/app/node_modules/electron-builder/src/linuxPackager.ts:197:15)
    at [object Generator].next (native)
    at tsAwaiter (/usr/src/app/node_modules/electron-builder/src/awaiter.ts:10:51)
    at LinuxPackager.buildDeb (/usr/src/app/node_modules/electron-builder/src/linuxPackager.ts:164:101)
    at LinuxPackager.<anonymous> (/usr/src/app/node_modules/electron-builder/src/linuxPackager.ts:160:23)
From previous event:
    at tsAwaiter (/usr/src/app/node_modules/electron-builder/src/awaiter.ts:10:51)
    at Object.build (/usr/src/app/node_modules/electron-builder/src/builder.ts:30:59)
    at Object.<anonymous> (/usr/src/app/node_modules/electron-builder/src/build-cli.ts:41:2)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:134:18)
    at node.js:962:3

npm info @ Failed to exec dist:linux64 script
npm ERR! Linux 4.2.2-coreos-r2
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "--unsafe-perm" "dist:linux64"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! @ dist:linux64: `build --platform linux --arch x64`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the @ dist:linux64 script 'build --platform linux --arch x64'.
npm ERR! This is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     build --platform linux --arch x64
npm ERR! You can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log
root@ed1ed8c0e24f:/usr/src/app# fpm -v
Missing required -s flag. What package source did you want? {:level=>:warn}
Missing required -t flag. What package output did you want? {:level=>:warn}
No parameters given. You need to pass additional command arguments so that I know what you want to build packages from. For example, for '-s dir' you would pass a list of files and directories. For '-s gem' you would pass a one or more gems to package from. As a full example, this will make an rpm of the 'json' rubygem: `fpm -s gem -t rpm json` {:level=>:warn}
Fix the above problems, and you'll be rolling packages in no time! {:level=>:fatal}

Does anyone has any idea why this is happening? Or what to do to fix it?

develar commented 8 years ago

Thanks for detailed issue report.

Please xz --version?

Try to set compression to gz (see https://github.com/electron-userland/electron-builder/wiki/Options#buildlinux).

develar commented 8 years ago

Yep, it seems xz is not installed on your system.

develar commented 8 years ago

And please update fpm to 1.5 (gem update fpm).

maxcnunes commented 8 years ago

Awesome! Just changing the compression was enough. Thanks @develar :clap:

develar commented 8 years ago

@maxcnunes Please use only xz. So, please install xz. I use Ubuntu to test — xz installed by default and I guess on Debian it should be available as well.

maxcnunes commented 8 years ago

Ok. I have installed xz with xz-utils package and now it is working without setting the compression type. Maybe would be good include this package in https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build#linux.

develar commented 8 years ago

Thanks! I will fix docs.

maxcnunes commented 8 years ago

I got another problem building windows on Linux.

npm info ok
Removing /usr/src/app/dist/win-x64
Downloading electron-v0.37.5-win32-x64.zip
[============================================>] 100.0% of 47.05 MB (635.8 kB/s)
Packaging app for platform win32 x64 using electron v0.37.5
Error: spawn mono ENOENT
    at exports._errnoException (util.js:870:11)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:178:32)
    at onErrorNT (internal/child_process.js:344:16)
    at nextTickCallbackWith2Args (node.js:437:9)
    at process._tickCallback (node.js:351:17)
From previous event:
    at spawn (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/spawn-promise.js:22:10)
    at Object.<anonymous> (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/index.js:111:38)
    at [object Generator].next (native)
    at /usr/src/app/node_modules/electron-builder/node_modules/fs-extra/node_modules/graceful-fs/graceful-fs.js:43:10
    at /usr/src/app/node_modules/electron-builder/node_modules/read-package-json/node_modules/graceful-fs/graceful-fs.js:43:10
    at FSReqWrap.oncomplete (fs.js:82:15)
From previous event:
    at Object.createWindowsInstaller (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/index.js:175:16)
    at WinPackager.<anonymous> (/usr/src/app/node_modules/electron-builder/src/winPackager.ts:144:48)
    at [object Generator].next (native)
From previous event:
    at tsAwaiter (/usr/src/app/node_modules/electron-builder/src/awaiter.ts:10:51)
    at Object.build (/usr/src/app/node_modules/electron-builder/src/builder.ts:30:59)
    at Object.<anonymous> (/usr/src/app/node_modules/electron-builder/src/build-cli.ts:41:2)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:134:18)
    at node.js:962:3

npm info @ Failed to exec dist:win64 script
npm ERR! Linux 4.3.6-coreos
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist:win64"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! @ dist:win64: `build --platform win32 --arch x64`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the @ dist:win64 script 'build --platform win32 --arch x64'.
npm ERR! This is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     build --platform win32 --arch x64
npm ERR! You can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log

After some debugging it I found out that /usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/index.js:111:38 was trying to execute itL

>>>>cmd mono
>>>>args [ '/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/vendor/nuget.exe',
  'pack',
  '/usr/src/app/si-116313-4299-1o55t3m/Sqlectron.nuspec',
  '-BasePath',
  '/usr/src/app/dist/Sqlectron-win32-x64',
  '-OutputDirectory',
  '/usr/src/app/si-116313-4299-1o55t3m',
  '-NoDefaultExcludes',
  '-NonInteractive',
  '-Verbosity',
  'quiet' ]

Then I have installed mono-complete following these steps http://www.mono-project.com/docs/getting-started/install/linux/#debian-ubuntu-and-derivatives.

After that I got this error:

npm info ok
Removing /usr/src/app/dist/win-x64
Packaging app for platform win32 x64 using electron v0.37.5
System.InvalidOperationException: The input package file /usr/src/app/dist/win-x64/Sqlectron.1.5.0.nupkg targets no platform and cannot be transformed into a release package.
  at Squirrel.ReleasePackage.CreateReleasePackage (System.String outputFile, System.String packagesRootDir, System.Func`2 releaseNotesProcessor, System.Action`1 contentsPostProcessHook) [0x00000] in <filename unknown>:0
  at Squirrel.Update.Program.Releasify (System.String package, System.String targetDir, System.String packagesDir, System.String bootstrapperExe, System.String backgroundGif, System.String signingOpts, System.String baseUrl, System.String setupIcon, Boolean generateMsi) [
0x00000] in <filename unknown>:0
  at Squirrel.Update.Program.executeCommandLine (System.String[] args) [0x00000] in <filename unknown>:0
  at Squirrel.Update.Program.main (System.String[] args) [0x00000] in <filename unknown>:0
Error: mono failed with exit code: 255
    at ChildProcess.<anonymous> (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/spawn-promise.js:33:16)
    at emitTwo (events.js:87:13)
    at ChildProcess.emit (events.js:172:7)
    at maybeClose (internal/child_process.js:821:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
From previous event:
    at spawn (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/spawn-promise.js:22:10)
    at Object.<anonymous> (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/index.js:155:38)
    at [object Generator].next (native)
    at processImmediate [as _immediateCallback] (timers.js:383:17)
From previous event:
    at Object.createWindowsInstaller (/usr/src/app/node_modules/electron-builder/node_modules/electron-winstaller-fixed/lib/index.js:175:16)
    at WinPackager.<anonymous> (/usr/src/app/node_modules/electron-builder/src/winPackager.ts:144:48)
    at [object Generator].next (native)
From previous event:
    at tsAwaiter (/usr/src/app/node_modules/electron-builder/src/awaiter.ts:10:51)
    at Object.build (/usr/src/app/node_modules/electron-builder/src/builder.ts:30:59)
    at Object.<anonymous> (/usr/src/app/node_modules/electron-builder/src/build-cli.ts:41:2)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Function.Module.runMain (module.js:441:10)
    at startup (node.js:134:18)
    at node.js:962:3

npm info @ Failed to exec dist:win64 script
npm ERR! Linux 4.3.6-coreos
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dist:win64"
npm ERR! node v4.3.2
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! @ dist:win64: `build --platform win32 --arch x64`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the @ dist:win64 script 'build --platform win32 --arch x64'.
npm ERR! This is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     build --platform win32 --arch x64
npm ERR! You can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /usr/src/app/npm-debug.log

Any idea how to fix that?

develar commented 8 years ago

@maxcnunes Please file separate issue in the future. Your issue — mono/wine is outdated, please see https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build#linux about mono/wine installation on Linux. wine must be 1.8+, mono must be 4+.

MadsRC commented 8 years ago

The README could do with a bit of work. I had the exact same issue, albeit on a Mac (trying to build for Linux). Solved the FPM related error by installing xz. Maybe xz should be added as a dependency?

develar commented 8 years ago

@MadsRC It is documented here https://github.com/electron-userland/electron-builder/wiki/Multi-Platform-Build#linux xz-utils in the list of required packages.

develar commented 8 years ago

Maybe xz should be added as a dependency?

Yeah, it is a problem — xz-utils and fpm is a system packages, not npm. So, you have to read docs and it is not a user-friendly.