I am trying to start writing React code on my new PC. I have installed npm but any time I run create-react-app, I am getting this error.
$ npx create-react-app code-app
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:UsersUSERAppDataRoamingnpm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat 'C:UsersUSERAppDataRoamingnpm'
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:UsersUSERAppDataLocalnpm-cache_logs2023-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.
2
Answers
This can happen for a multitude of reasons.
My guess is that a folder where npm was installed in your computer was moved to a different folder or removed.
Try to reinstall npm with the command
npm install -g npm
.If it fails you can follow this guide:
https://stackoverflow.com/a/20711410/13970434
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:
Then try to update npm