-1

I'm trying to learn how to use React and I'm having an issue with create-react-app: https://create-react-app.dev/docs/getting-started/

I ran into issues during the installation I was using

npx create-react-app my-app
cd my-app
npm start

as suggested in the tutorial.

All I did was npx create-react-app my-app but the error I got from terminal was

Qubes-MacBook-Pro:~ qube$ pwd
/Users/qube
Qubes-MacBook-Pro:~ qube$ ls
Applications        Desktop         Downloads       Movies          NetBeansProjects    Postman         apache-maven-3.6.1  docker          package-lock.json
Books           Documents       Library         Music           Pictures        Public          apache-tomcat-8.5.11    node_modules
Qubes-MacBook-Pro:~ qube$ npx create-react-app my-app
npm ERR! path /Users/qube/.npm/_cacache/index-v5/4c/c4
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir
npm ERR! Error: EACCES: permission denied, mkdir '/Users/qube/.npm/_cacache/index-v5/4c/c4'
npm ERR!  { [Error: EACCES: permission denied, mkdir '/Users/qube/.npm/_cacache/index-v5/4c/c4']
npm ERR!   cause:
npm ERR!    { Error: EACCES: permission denied, mkdir '/Users/qube/.npm/_cacache/index-v5/4c/c4'
npm ERR!      errno: -13,
npm ERR!      code: 'EACCES',
npm ERR!      syscall: 'mkdir',
npm ERR!      path: '/Users/qube/.npm/_cacache/index-v5/4c/c4' },
npm ERR!   isOperational: true,
npm ERR!   stack:
npm ERR!    'Error: EACCES: permission denied, mkdir \'/Users/qube/.npm/_cacache/index-v5/4c/c4\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/Users/qube/.npm/_cacache/index-v5/4c/c4',
npm ERR!   parent: 'external-editor' }
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 (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/qube/.npm/_logs/2019-12-22T01_29_40_120Z-debug.log
Install for create-react-app@latest failed with code 243

I tried looking for a fix but it suggested to use sudo chown -R $USER /usr/local/lib/node_modules

How can I fix this issue?

halfer
  • 19,824
  • 17
  • 99
  • 186
Qube
  • 13
  • 1
  • 5
  • Looks like a permission issue. Can you try running the command `sudo npx create-react-app my-app` and see if it works. – stud3nt Dec 22 '19 at 02:02

2 Answers2

1

This seems to be permissions issue. Can you create this directory manually and try to rerun it? Users/qube/.npm/_cacache/index-v5/4c/c4.

Ganesh C
  • 203
  • 1
  • 2
  • 10
-1

Realized you should not use the command in the User/username directory as it'll cause issues so instead use the

npx create-react-app my-app
cd my-app
npm start

on your app directory for example in a directory on your Desktop

Qube
  • 13
  • 1
  • 5