とりあえずこれ
$ npm install -g react-devtools
するとこう
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/test/.npm/_logs/2019-10-13T14_15_26_192Z-debug.log
あーpermissionかーと思ってsudoつけてみる
$ sudo npm install -g react-devtools
Password:
/usr/local/bin/react-devtools -> /usr/local/lib/node_modules/react-devtools/bin.js
> electron@5.0.11 postinstall /usr/local/lib/node_modules/react-devtools/node_modules/electron
> node install.js
/usr/local/lib/node_modules/react-devtools/node_modules/electron/install.js:49
throw err
^
Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/react-devtools/node_modules/electron/.electron'
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! electron@5.0.11 postinstall: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron@5.0.11 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/test/.npm/_logs/2019-10-13T14_15_56_167Z-debug.log
ダメじゃん!
で色々ググった結果が
$ sudo npm install -g react-devtools --unsafe-perm=true
/usr/local/bin/react-devtools -> /usr/local/lib/node_modules/react-devtools/bin.js
> electron@5.0.11 postinstall /usr/local/lib/node_modules/react-devtools/node_modules/electron
> node install.js
Downloading tmp-16816-1-SHASUMS256.txt-5.0.11
[============================================>] 100.0% of 4.79 kB (4.79 kB/s)
+ react-devtools@4.2.0
added 233 packages from 157 contributors in 27.794s
これで解決 npmはroot以外でインストールするときにunsafe-permのパラメをtrueにしないといけないっぽい。
参考にさせていただいたサイト様
https://github.com/facebook/react-devtools/issues/741
http://esheep.doorblog.jp/archives/22432883.html