折腾:
期间,
➜ ~ npm install -g yarn react-native-cli npm ERR! tar.unpack untar error /Users/crifan/.npm/yarn/0.21.3/package.tgz npm ERR! tar.unpack untar error /Users/crifan/.npm/react-native-cli/2.0.1/package.tgz npm ERR! Darwin 16.4.0 npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "yarn" "react-native-cli" npm ERR! node v4.4.7 npm ERR! npm v2.15.8 npm ERR! path /usr/local/lib/node_modules/yarn npm ERR! code EACCES npm ERR! errno -13 npm ERR! syscall mkdir npm ERR! Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/yarn’ npm ERR! at Error (native) npm ERR! { [Error: EACCES: permission denied, mkdir ‘/usr/local/lib/node_modules/yarn’] npm ERR! errno: -13, npm ERR! code: ‘EACCES’, npm ERR! syscall: ‘mkdir’, npm ERR! path: ‘/usr/local/lib/node_modules/yarn’, npm ERR! fstream_type: ‘Directory’, npm ERR! fstream_path: ‘/usr/local/lib/node_modules/yarn’, npm ERR! fstream_class: ‘DirWriter’, npm ERR! fstream_stack: npm ERR! [ ‘/usr/local/lib/node_modules/npm/node_modules/fstream/lib/dir-writer.js:35:25’, npm ERR! ‘/usr/local/lib/node_modules/npm/node_modules/mkdirp/index.js:47:53’, npm ERR! ‘FSReqWrap.oncomplete (fs.js:82:15)’ ] } npm ERR! 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/crifan/npm-debug.log ➜ ~ |
参考文档去:
sudo chown -R `whoami` /usr/local |
就可以继续了:
【总结】
此处,安装React Native期间:
npm install -g yarn react-native-cli
出现错误:
npm ERR! Error: EACCES: permission denied
原因是没有访问权限。
解决办法:
sudo chown -R `whoami` /usr/local |
再重新安装,即可。
转载请注明:在路上 » 【已解决】npm安装yarn react-native-cli时出错:npm ERR Error EACCES permission denied