无法处理 "npm install -g create-react-native-app"

Cannot process "npm install -g create-react-native-app"

我刚开始学习 React Native。我已经在 mac 上安装了 Node.js,然后我尝试通过命令 "npm install -g create-react-native-app" 安装 React Native(我按照其官方网站上的安装指南进行操作)。但在那之后,出现了下面的信息:

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
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!  { 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! Please try running this command again as root/Administrator.

谁能告诉我这个问题的根本原因?如果有人能给我线索,我很高兴,这样我就可以继续学习这项技术 (React Native),因为我计划使用它制作一个小型 IOS 应用程序项目。谢谢^^。

Please try running this command again as root/Administrator.

运行 全局 安装命令 sudo:

sudo npm install -g create-react-native-app

并输入您的密码。