LoginSignup
24
12

More than 5 years have passed since last update.

Electronのインストールでエラーになる時の対処法

Last updated at Posted at 2018-04-25

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
24
12
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
24
12