% npm install -g electron
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js
> core-js@3.8.3 postinstall /usr/local/lib/node_modules/electron/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> electron@11.2.0 postinstall /usr/local/lib/node_modules/electron
> node install.js
+ electron@11.2.0
added 92 packages from 95 contributors in 5.437s
estis@iMac4 ~ % ls -ld /usr/local/lib/node_modules/
drwxrwxrwx 4 root wheel 128 1 21 22:13 /usr/local/lib/node_modules/
estis@iMac4 ~ % ls -l /usr/local/lib/node_modules/
total 0
drwxr-xr-x 12 estis wheel 384 1 21 22:13 electron
drwxr-xr-x 24 root wheel 768 1 4 22:55 npm
estis@iMac4 ~ % sudo npm install -g electron
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js
> electron@11.2.0 postinstall /usr/local/lib/node_modules/electron
> node install.js
Error: EACCES: permission denied, mkdtemp '/usr/local/lib/node_modules/electron/electron-download-SWGoew'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@11.2.0 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@11.2.0 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! /Users/me/.npm/_logs/2021-01-21T13_13_54_940Z-debug.log
とエラーになったので、 /usr/local/lib/node_modules/ のパーミッションを変更した。
これでインストールできた。
% sudo chmod 777 /usr/local/lib/node_modules/
% npm install -g electron
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js
> core-js@3.8.3 postinstall /usr/local/lib/node_modules/electron/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"
> electron@11.2.0 postinstall /usr/local/lib/node_modules/electron
> node install.js
+ electron@11.2.0
added 92 packages from 95 contributors in 5.269s
estis@iMac4 ~ % sudo chmod 777 /usr/local/lib/node_modules/
estis@iMac4 ~ % npm install -g electron
/usr/local/bin/electron -> /usr/local/lib/node_modules/electron/cli.js
> electron@11.2.0 postinstall /usr/local/lib/node_modules/electron
> node install.js
+ electron@11.2.0
updated 1 package in 4.061s