#前提
npm install expo-cli --global
でexpo-cliを使用できるようにインストールしようとした時のお話
mac
#本題
npm install expo-cli --global
で下記のようなpermission deniedのエラー発生。
terminal.
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for @expo/ngrok-bin-freebsd-x64@2.2.8: wanted {"os":"freebsd","arch":"x64"} (current: {"os":"darwin","arch":"x64"})
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
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: "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!
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.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/ユーザー名/.npm/_logs/2020-05-14T12_14_47_487Z-debug.log
#解決方法
nmpの公式サイトを見ると解決!
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
もう一度、npm install expo-cli --global
実行!
expo --version
でインストールできているか確認!
expo-cliでできること
JavaScriptのコードをビルドする
本番公開の際にpublishする