终端:"npm install -g react-native-cli"

use*_*019 1 macos npm

npm install -g react-native-cli

npm ERR! tar.unpack untar error /Users/qufenqi/.npm/react-native-     cli/0.1.4/package.tgz
npm ERR! Darwin 14.3.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "react-native-cli"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
 npm ERR! path /usr/local/lib/node_modules/react-native-cli
npm ERR! code EACCES
Run Code Online (Sandbox Code Playgroud)

错误的ERR!errno -13

npm ERR! Error: EACCES, mkdir '/usr/local/lib/node_modules/react-native-cli'
npm ERR!     at Error (native)
npm ERR!  { [Error: EACCES, mkdir '/usr/local/lib/node_modules/react-native-      cli']
 npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/usr/local/lib/node_modules/react-native-cli',
npm ERR!   fstream_type: 'Directory',
npm ERR!   fstream_path: '/usr/local/lib/node_modules/react-native-cli',
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:95:15)' ] }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with a
Run Code Online (Sandbox Code Playgroud)

但是当我安装节点时,说"brew install节点警告:node-0.12.7已经安装,它只是没有链接"

Edu*_*eda 5

您没有该目录的写入权限

/usr/local/lib/node_modules/react-native-cli
Run Code Online (Sandbox Code Playgroud)

当您要在全局安装库时,您需要管理员权限,因此使用sudo命令以root身份执行此操作:

sudo npm install -g react-native-cli
Run Code Online (Sandbox Code Playgroud)