Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

create-react-app Failing to create a new React app in windows 10

Tags:

reactjs

I have Create-react-app version 1.4.3 installed. When I try to create a new App , I get the following messages in the command prompt. Please help me find and fix the issue.

C:\Users\GSI-KOL\Desktop\server>create-react-app client

Creating a new React app in C:\Users\GSI-KOL\Desktop\server\client.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

[email protected] postinstall C:\Users\GSI-KOL\Desktop\server\client\node_modules\uglifyjs-webpack-plugin
node lib/post_install.js

npm ERR! path C:\Users\GSI-KOL\Desktop\server\client\node_modules\fsevents\node_modules
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall lstat
npm ERR! Error: EPERM: operation not permitted, lstat 'C:\Users\GSI-KOL\Desktop\server\client\node_modules\fsevents\node_modules'
npm ERR!  { Error: EPERM: operation not permitted, lstat 'C:\Users\GSI-KOL\Desktop\server\client\node_modules\fsevents\node_modules'
npm ERR!   stack: 'Error: EPERM: operation not permitted, lstat \'C:\\Users\\GSI-KOL\\Desktop\\server\\client\\node_modules\\fsevents\\node_modules\'',
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'lstat',
npm ERR!   path: 'C:\\Users\\GSI-KOL\\Desktop\\server\\client\\node_modules\\fsevents\\node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
    
npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\GSI-KOL\AppData\Roaming\npm-cache\_logs\2017-11-08T13_08_03_705Z-debug.log
    
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
    
Deleting generated file... node_modules
Deleting generated file... package.json
Deleting client / from C:\Users\GSI-KOL\Desktop\server
Done.
    
C:\Users\GSI-KOL\Desktop\server>
like image 577
Sanat P Avatar asked Nov 08 '17 13:11

Sanat P


People also ask

Why react app is not creating?

If you really need create-react-app , you might need to reinstall Node and reconfigure your dependencies to ensure you have a fresh start with Node, npm, npx, and the like.

How do I get rid of global installation of create react app?

If you've previously installed create-react-app globally via npm install -g create-react-app , we recommend you uninstall the package using npm uninstall -g create-react-app or yarn global remove create-react-app to ensure that npx always uses the latest version.

How do you check if Create react app is installed?

The other method is also straightforward, you can check the React app version by heading over to node_modules/react/cjs/react. development. js. You can see the react project version in the commented section as showing given below.


3 Answers

I was faced this same problem . It is due to the issue with npm .

please run the following command in command Line

npm cache clean --force 

then run

create-react-app <project Name> 

If your problem still exist then switch from npm to yarn

run the following commands, it solved my problem

npm install -g yarn  yarn global add create-react-app  create-react-app <projectname> 
like image 114
Alex Varghese Avatar answered Sep 30 '22 08:09

Alex Varghese


It looks like you need admin privileges to write some of the generated files. Can you create a terminal instance with administrator rights then reissue the command?

like image 35
duhaime Avatar answered Sep 30 '22 08:09

duhaime


You probably had "create-react-app" running before, which was the problem in my case anyway. The way I solved this was using npm cache clean --force and ran create-react-app my-app again.

like image 27
Tobi Adedipe Avatar answered Sep 30 '22 06:09

Tobi Adedipe