0

I just changed a new laptop to MacBook air using Catalina. I was successfully installed Node when I tried install Reactjs but it says 'permission denied' to node file as below:

zulfadliazhar@Zulfadlis-MacBook-Air ~ % npm install -g create-react-app

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules npm ERR! code EACCES npm ERR! syscall access npm ERR! path /usr/local/lib/node_modules npm ERR! errno -13 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! errno: -13, npm ERR! code: 'EACCES', npm ERR! syscall: 'access', npm ERR!
path: '/usr/local/lib/node_modules' npm ERR! } npm ERR! npm ERR! The operation was rejected by your operating system. npm ERR! It is likely you do not have the permissions to access this file as the current user npm ERR! npm ERR! If you believe this might be a permissions issue, please double-check the npm ERR! permissions of the file and its containing directories, or try running npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: npm ERR!
/Users/zulfadliazhar/.npm/_logs/2020-05-15T01_03_00_850Z-debug.log

zulfadliazhar@Zulfadlis-MacBook-Air ~ % create-react-app --version

zsh: command not found: create-react-app

Please assist me.

Thank you

imran haider
  • 325
  • 4
  • 7

1 Answers1

0

You need the sudo rights to install something in -g (it means global) because it will install it here => /usr/local/lib/node_modules

so you just need to retry like this sudo npm install -g create-react-app

William Scalabre
  • 635
  • 4
  • 13