Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

npm shows an error 'ENOENT: no such file or directory' when creating a react project

I've installed Node.js for Windows and I'm trying to create a new React project via npm. Upon typing 'npx create-react-app projectName', I receive the following error:

ENOENT: no such file or directory, lstat 'C:\Users\Username\AppData\Roaming\npm'

Does anyone know how to fix this error?

like image 240
Hasitha Avatar asked Jul 12 '26 12:07

Hasitha


2 Answers

I got the exact same error with npx nuxi@latest init my-app and the solution was surprisingly simple. Just create that missing directory.

mkdir "%AppData%\npm"
like image 110
ubershmekel Avatar answered Jul 15 '26 03:07

ubershmekel


I got the exact same error in my Next.js project. The following command worked:

npm install npm -g

Later on I got a similar error in my project so I re-built the project:

npm run build
like image 35
Jonathan Avatar answered Jul 15 '26 01:07

Jonathan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!