安装 npm install -g yarn react-native-cli 出现如下错误:
npm ERR! Darwin 14.5.0
npm ERR! argv “/usr/local/Cellar/node/5.5.0/bin/node” “/usr/local/bin/npm” “install” “–save” “react-native”
npm ERR! node v5.5.0
npm ERR! npm v3.5.3
npm ERR! path /Users/marksong/.npm/ws/0.8.1
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir ‘/Users/marksong/.npm/ws/0.8.1’
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir ‘/Users/marksong/.npm/ws/0.8.1’]
npm ERR! errno: -13,
npm ERR! code: ‘EACCES’,
npm ERR! syscall: ‘mkdir’,
npm ERR! path: ‘/Users/marksong/.npm/ws/0.8.1’,
npm ERR! parent: ‘react-native’ }
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/marksong/Desktop/Project(demo)/BookSearch/npm-debug.log
npm install --save react-native
failed
这是由于权限问题
解决方案 : 1 先执行 sudo chown -R whoami
/usr/local
再来执行: 2 npm install -g yarn react-native-cli
这期间我开启了vpn,稍微快点