Search code examples
reactjsnpmcreate-react-appnpx

Why am I getting errors when trying to create react app using 'create-react-app'?


I am trying to start writing React code on my new PC. I have installed npm, but when I run npx create-react-app, I am getting the following error:

$ npx create-react-app code-app
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:\Users\USER\AppData\Roaming\npm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:\Users\USER\AppData\Roaming\npm'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! A complete log of this run can be found in: C:\Users\USER\AppData\Local\npm-cache\_logs\2023-08-30T08_16_10_555Z-debug-0.log

I have tried to use git bash, VS Code terminal, Windows cmd to run it but still not coming up.


Solution

  • This may happen by several reasons like any issues in the directory of node or it may even happen if you are using any proxy or having any network connectivity issues, So try to switch your connection first. If it is not helping then try clearing cache:

    npm cache clean --force
    

    Then try to update npm

    npm install -g npm