electron-packager failing to build when run as roo

2019-07-28 05:46发布

The problem

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.

I've read that if you specify what to package it might fix this, but I don't know how to do that.

Successful run as user vagrant

$npm run-script pack
> electron-quick-start@1.0.0 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

$npm run-script pack
> electron-quick-start@1.0.0 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! electron-quick-start@1.0.0 pack: "electron-packager . MyApp --platform=linux --arch=x64 --prune"
npm ERR! Exit status 1
$

Environment Info

Mac OS X 10.11.5
Vagrant version: 1.8.4
Linux CentOS 7 3.10.0-327.18.2.el7.x86_64
node version: v6.4.0
npm version: v3.10.6
electron version: 1.3.4
electron-packager version: 7.7.0
Python version: 2.7.5
Buildbot version: 0.8.14
Buildslave version: 0.8.14
Twisted version: 16.3.2

标签: electron
0条回答
登录 后发表回答