CentOs8 Electronのインストール

CentOs8 Electronのインストール

Electronでアプリを開発ことになったので、インストールの手順

CentOs8バージョン

#cat /etc/centos-release
CentOS Linux release 8.0.1905 (Core)

インストール

## root で作業
su

## インストール
npm install -g electron

<出力結果>
Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@6.0.12 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@6.0.12 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2019-10-17T04_57_15_256Z-debug.log

## 下記コマンドで解決
npm install -g electron --unsafe-perm=true --allow-root

起動

## 起動
electron

エラー
/usr/lib/node_modules/electron/dist/electron: error while loading shared libraries: libXss.so.1: cannot open shared object file: No such file or directory

## libXScrnSaverをインストール
yum install libXScrnSaver

## 再度起動
electron

## エラー
Running as root without --no-sandbox is not supported. See https://crbug.com/638180

## rootでの実行が問題
su - testuser

## 再度起動
electron

無事起動