skip to Main Content

I was writing in my vs code terminal:

npx create-react-app my-app

and getting this error.

PS E:react> npx create-react-app my-app
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path C:Usersusername~1AppDataRoamingnpm-cache_cacachetmp7cf48de
npm ERR! errno -4048
npm ERR! Error: EPERM: operation not permitted, open 'C:Usersusername~1AppDataRoamingnpm-cache_cacachetmp7cf48de'
npm ERR!  [Error: EPERM: operation not permitted, open 'C:Usersusername~1AppDataRoamingnpm-cache_cacachetmp7cf48de'] {
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\Users\Nabanita~1\AppData\Roaming\npm-cache\


_cacache\tmp\07cf48de'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a text editor or antivirus),
npm ERR! or that you lack permissions to access it.
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! Log files were not written due to an error writing to the directory: C:Usersusername~1AppDataRoamingnpm-cache_logs
npm ERR! You can rerun the command with `--loglevel=verbose` to see the logs in your terminal
PS E:react>

i have tried all these command but nothing works for me.

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

2

Answers


  1. Try using sudo:

    sudo npx create-react-app my-app
    

    It seems like you may be having permission issues.

    Login or Signup to reply.
  2. Seems permission issue

    1: Try opening the Powershell or cmd as Administrator

    2: Next, try npm cache clean --force

    3: For immediate fix, you may use yarn

    npm install -g yarn
    yarn create react-app my-app
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search