Electron-packager: Problem when running electron-packager within Docker container

Created on 1 Dec 2015  路  17Comments  路  Source: electron/electron-packager

I'm experiencing weird issues with using [email protected] within a container. The container is executed

docker run -v $(pwd):/tmp/w -w /tmp/w node:4.2.2-wheezy ./build.sh

where the project directory is attached as a volume and the build script execution is passed as an argument to the container.

The base image is node:4.2.2-wheezy, which means the environment inside the container is Debian Wheezy.

The electron-packager is executed through npm like this:

electron-packager . $npm_package_productName --out=dist --ignore='^/dist$' --prune --asar --overwrite --platform=darwin,win32 --arch=all --version=$npm_package_electronVersion

Now, the problem is the execution suddenly hangs after executing the electron-packager and apparently nothing is happening. After 15-20mins the execution goes further:

Downloading electron-v0.34.2-win32-ia32.zip
[>                                            ] 0.0% (0 B/s)
Downloading electron-v0.34.2-win32-ia32.zip
[>                                            ] 0.0% of 40.03 MB (0 B/s)
Downloading electron-v0.34.2-win32-ia32.zip
[=============>                               ] 32.3% of 40.03 MB (12.95 MB/s)
Downloading electron-v0.34.2-win32-ia32.zip
[=============================>               ] 68.1% of 40.03 MB (27.24 MB/s)
Downloading electron-v0.34.2-win32-ia32.zip
[============================================>] 100.0% of 40.03 MB (32.03 MB/s)
Downloading electron-v0.34.2-win32-ia32.zip
[============================================>] 100.0% of 40.03 MB (32.03 MB/s)
Downloading electron-v0.34.2-win32-ia32.zip
[============================================>] 100.0% of 40.03 MB (32.03 MB/s)
Packaging app for platform win32 ia32 using electron v0.34.2

Then again the execution halts at Packaging app for platform win32 ia32 using electron v0.34.2 and after another 20mins npm goes on, however with no artifacts produced in the dist folder and no packaging for darwin platform or for win64.

This is happening for me on my Macbook Pro and our build server using different version of Docker.

bug needs info

All 17 comments

Is it possible to "attach" a Dockerfile so that someone can try to reproduce it themselves?

Also, forgive the possibly obvious question, but perhaps you ran out of room in your Docker image?

There is no actual Dockerfile written by me, it uses the official Node image https://hub.docker.com/_/node/ and it is run as mentioned in the previous post.

Our build.sh script contains a few npm commands - install, rebuild and running scripts defined in package.json; one of those scripts is executing electron-packager in the form mentioned in my previous post.

The space should not be issue - the container operates over that volume which is actually the folder on host system (you can notice that $(pwd)). I'm also not aware of any default resource constraints in Docker...

Important thing to mention - it works well outside of container (i.e. when I execute build.sh script on my machine); however there are reasons why we want to use Docker container for build (we don't have control over our CI server)

my guess would be the docker virtual file system is slow. you could try running electron-packager with DEBUG=extract-zip to monitor unzip progress, maybe thats the culprit?

I tried aforementioned DEBUG as well, however in the end there was a weird problem with recursion. The fix was to precisely specify what is supposed to be packaged. I still consider this a bug, since the packaging worked outside of Docker container with exactly the same settings, however I'm closing it because I was not able to figure out what exactly is causing this.

@maxogden as per your suggestion, I am stuck here:

Mon, 08 Feb 2016 08:33:23 GMT extract-zip zipfile entry Electron.app/Contents/Resources/uk.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip extracting entry { filename: 'Electron.app/Contents/Resources/uk.lproj/',
  isDir: true,
  isSymlink: false }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip mkdirp { dir: '/chill/electron-packager/darwin-x64-template/Electron.app/Contents/Resources/uk.lproj/' }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip finished processing Electron.app/Contents/Resources/uk.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip zipfile entry Electron.app/Contents/Resources/vi.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip extracting entry { filename: 'Electron.app/Contents/Resources/vi.lproj/',
  isDir: true,
  isSymlink: false }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip mkdirp { dir: '/chill/electron-packager/darwin-x64-template/Electron.app/Contents/Resources/vi.lproj/' }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip finished processing Electron.app/Contents/Resources/vi.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip zipfile entry Electron.app/Contents/Resources/zh_CN.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip extracting entry { filename: 'Electron.app/Contents/Resources/zh_CN.lproj/',
  isDir: true,
  isSymlink: false }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip mkdirp { dir: '/chill/electron-packager/darwin-x64-template/Electron.app/Contents/Resources/zh_CN.lproj/' }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip finished processing Electron.app/Contents/Resources/zh_CN.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip zipfile entry Electron.app/Contents/Resources/zh_TW.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip extracting entry { filename: 'Electron.app/Contents/Resources/zh_TW.lproj/',
  isDir: true,
  isSymlink: false }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip mkdirp { dir: '/chill/electron-packager/darwin-x64-template/Electron.app/Contents/Resources/zh_TW.lproj/' }
Mon, 08 Feb 2016 08:33:23 GMT extract-zip finished processing Electron.app/Contents/Resources/zh_TW.lproj/
Mon, 08 Feb 2016 08:33:23 GMT extract-zip zip extraction complete

@byF Could you elaborate how you fixed this? I've stumbled across the same issue, the packager works fine locally, but fails with an ENAMETOOLONG on Docker

@madebysid we ended up putting into the container as few files as possible. That fixed the recursion issue.

This is happening to me without use of Docker on an OSX 10.10 Mac Mini build machine. It works fine on my local machine (OSX 10.11) but on the mini every build fails with multiple ENAMETOOLONG:

errno: -63,
code: 'ENAMETOOLONG',
syscall: 'unlink',
path: '/Users/cruisecontrol/cni-bulk/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/electron-packager/darwin-x64/cni-darwin-x64/Electron.app/Contents/Resources/app/node_modules/react-json-tree/node_modules/core-js/library/fn/string/virtual/trim.js' },

Node 5.10.1, npm 3.8.3, electron-packager 6.0.2

@dennyferra it looks like you need to ignore your out directory for some reason.

@malept Thanks that resolved it

@malept I'm having the same problem as @dennyferra but aren't sure what you mean by ignore your out folder. Could you elaborate?

@bgrayburn Ignore the folder where the app bundles are being written.

I've had similar problem (also ENAMETOOLONG on Docker/OSX). In my case moving the output to tmp did not help. What was the problem? My project had a structure where there was a directory "app/resources" which caused all the havok, renaming it to something like "app/files" resolved the issue. The "resources" directory in my project was in conflict with the "resources" directory used by electron-packager.

I'm having similar issue. ENAMETOOLONG error.

I run these commands:
git clone electron-quick-start
cd electron-quick-start
npm install
npm install electron-packager --save-dev
npm run-script pack
which runs:
electron-packager . MyApp --platform=linux --arch=x64 --prune

When in vagrant, as user vagrant, it works.
When I run it in vagrant, as root, it fails with ENAMETOOLONG error.
When I run in Docker container, as root, it fails the same way as well.
Problem is my CI, buildbot, runs as root.

vagrant path: PATH=/usr/local/sbin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/node-v6.4.0-linux-x64/bin
root path: /usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/opt/node-v6.4.0-linux-x64/bin

I've tried using --out=dist --ignore=dist but that doesn't work.

@byF recommends to specify what to package, but I don't see how to do that.

Successful run as user vagrant
[email protected] pack /home/vagrant/electron-quick-start
electron-packager . MyApp --platform=linux --arch=x64 --prune

Packaging app for platform linux x64 using electron v1.3.4
Wrote new app to /home/vagrant/electron-quick-start/MyApp-linux-x64

Error run as user root
[email protected] pack /root/electron-quick-start
electron-packager . MyApp --platform=linux --arch=x64 --prune

Packaging app for platform linux x64 using electron v1.3.4
[ { Error: ENAMETOOLONG: name too long, unlink '/root/electron-quick-start/electron-packager/linux-x64/MyApp-linux-x64/resources/app/electron-packager/linux-x64/MyApp-linux-x64/resources...(Alot of repetition)...MyApp-linux-x64/blink_image_resources_200_percent.pak'
at Error (native)
errno: -36,
code: 'ENAMETOOLONG',
syscall: 'unlink',

Several screens full of similar error, but different file names at end, finally:

npm ERR! Linux 3.10.0-327.18.2.el7.x86_64
npm ERR! argv "/opt/node-v6.4.0-linux-x64/bin/node" "/bin/npm" "run-script" "pack"
npm ERR! node v6.4.0
npm ERR! npm v3.10.6
npm ERR! code ELIFECYCLE
npm ERR! [email protected] pack: electron-packager . MyApp --platform=linux --arch=x64 --prune
npm ERR! Exit status 1

Posted question to Stack Overflow as well: question

Haven't found fix for this problem, but worked around it by provisioning my VM with sudo only when needed, not for pip install buildbot-slave etc. So Buildbot worker running as vagrant now and all is well.

i had the same issue, I just ignored electron-packager and it works, add --ignore=electron-packager

for me the problem was that I was missing the author property in package.json (it was causing an endless loop searching for it) which is required for the win32 target
also for win32, a 32 bit version of wine is required which was installed on the host machine, but not in the container.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

29e7e280-0d1c-4bba-98fe-f7cd3ca7500a picture 29e7e280-0d1c-4bba-98fe-f7cd3ca7500a  路  4Comments

Write-Guy picture Write-Guy  路  3Comments

andreabisello picture andreabisello  路  3Comments

caishengmao picture caishengmao  路  3Comments

TracyGJG picture TracyGJG  路  5Comments