I’m trying to install with:
npx create-react-app my-app
PS D:ProgrammingJsReact> npx create-react-app my-app
npm ERR! code ENOENT
npm ERR! syscall lstat
npm ERR! path C:UsersNGUYEN THI PHUCAppDataRoamingnpm
npm ERR! errno -4058
npm ERR! enoent ENOENT: no such file or directory, lstat ‘C:UsersNGUYEN
THI PHUCAppDataRoamingnpm’
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:
npm ERR! C:UsersNGUYEN THI PHUCAppDataLocalnpm-cache_logs2023 07-08T04_35_31_903Z-debug-0.log
I use npm 9.5.1, nodejs 18.16.1
I tried redownload my nodejs but it still doesn’t work.
2
Answers
the npm command is unable to find a file or directory, specifically C:UsersNGUYEN THI PHUCAppDataRoamingnpm. This issue can be caused by various reasons such as missing or corrupted files
npm cache clean –force
npm uninstall -g create-react-app
npm install -g create-react-app
Check if the npm directory exists in your user directory (C:UsersNGUYEN THI PHUCAppDataRoaming).
Verify that the npm directory is added to your system’s PATH environment variable. To check this
echo %PATH%
Look for the path that includes npm (e.g., C:UsersNGUYEN THI PHUCAppDataRoamingnpm). If its missing you need to add it to the PATH variable.
I guess npm 9.5.1 and Node.js 18.16.1, do not align with the typical versioning scheme for npm and Node.js. You can use the latest stable version of the both .
clean the npm cache:
npm cache clean --force
.Make sure You have proper access to these commands if you are using windows.
Uninstall and reinstall create-react-app:
npm uninstall -g create-react-app
Then, reinstall create-react-app globally using the following command:
npm install -g create-react-app
After these steps, try running the create-react-app command again:
npx create-react-app my-app
This should work now .