9
3

More than 3 years have passed since last update.

expo-cliのinstallでpermission deniedエラー

Last updated at Posted at 2020-05-14

前提

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する

9
3
0

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
9
3