mac下npm install -g yarn react-native-cli出错

在mac系统中,使用npm安装yarn时出错,命令如下:

npm install -g yarn react-native-cli

npm ERR! Darwin 13.4.0

npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yarn" "react-native-cli"

npm ERR! node v6.9.2

npm ERR! npm  v3.10.9

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!     at Error (native)

npm ERR!  { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

npm ERR!     at Error (native)

npm ERR!   errno: -13,

npm ERR!   code: 'EACCES',

npm ERR!   syscall: 'access',

npm ERR!   path: '/usr/local/lib/node_modules' }

npmERR! 

npm ERR! Please try running this command again as root/Administrator.


npm ERR! Please include the following file with any support request:

npm ERR!     /Users/sailon/npm-debug.log

仔细看错误,

Please try running this command again as root/Administrator.

可能就是权限不足,因此切换到最高权限去执行命令

sudo -s

然后在执行命令


npm install -g yarn react-native-cli

这样就安装成功了!



你可能感兴趣的:(React,Native)