Xiufen Xu Xiufen Xu - 1 year ago 126
Node.js Question

How to install create-react-app through terminal

I am installing create-react-app through terminal. I have checked the node.js version is 4.5.0, which is higher than the requirement here. and the version of npm is 2.15.9. Then I type the command

npm install -g create-react-app
, there came out such error information:

npm ERR! tar.unpack untar error /Users/xiufenxu/.npm/create-react-app/0.6.0/package.tgz
npm ERR! Darwin 16.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "create-react-app"
npm ERR! node v4.5.0
npm ERR! npm v2.15.9
npm ERR! path /usr/local/lib/node_modules/create-react-app
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/create-react-app'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/create-react-app']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/create-react-app',
npm ERR! fstream_type: 'Directory',
npm ERR! fstream_path: '/usr/local/lib/node_modules/create-react-app',
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/xiufenxu/Documents/UM courses/Fall 2016/CSCI 5117/npm-debug.log

I wondering why I got such errors. Is there anyone who can help me to figure out this problem? Thank you so much!

Answer Source
sudo npm install -g create-react-app

you're running it as a user without root permissions

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download