Electronのインストールは
$ sudo npm install -g electron
で行うという記事を見つけたので、実行したところ、以下のエラーが発生。
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js
> electron@1.8.4 postinstall /usr/local/lib/node_modules/electron
> node install.js
/usr/local/lib/node_modules/electron/install.js:47
throw err
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/electron/dist'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@1.8.4 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@1.8.4 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
エラーメッセージでいろいろと検索したところ、GithubのIssueで解決策を発見。
以下のコマンドで無事インストールできた。
$ sudo npm install -g electron --unsafe-perm=true --allow-root