I have tried these two commands and am getting the same error.
npm clean cache --force
npx create-react-app client -timeout=120000
$ npx create-react-app client -timeout=120000
npm WARN exec The following package was not found and will be installed: create-react-app
npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Creating a new React app in C:\web_dev\MERN\projects\booking-app\client.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! code ERR_SOCKET_TIMEOUT
npm ERR! errno ERR_SOCKET_TIMEOUT
npm ERR! network request to https://registry.npmjs.org/lodash.sortby/-/lodash.sortby-4.7.0.tgz failed, reason: Socket timeout
npm ERR! network This is a problem related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\web_dev\MERN\projects\booking-app\tmpnodejsnpm-cache\_logs\2021-12-29T13_37_03_989Z-debug-0.log
Aborting installation.
npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting client/ from C:\web_dev\MERN\projects\booking-app
Done.
I have just faced the same issue when upgrading an old project. What solved, in my case was:
If you use yarn:
yarn global remove create-react-app
yarn cache clean
If you use npm:
npm remove create-react-app
npx clear-npx-cache
Also make sure there is no folder in the directory where you will created the new React project because you can get another warning similar to:
The directory . contains files that could conflict:
<the file(s) name here>/
Either try using a new directory name, or remove the files listed above.
After that, npx create-react-app . ran smoothly.
Those steps described above solved the following subsequent warnings (versions may vary).:
Global warning
You are running "create-react-app" 4.0.3, which is behind the latest release (5.0.0).
We no longer support global installation of Create React App.
tar warning
tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
Even I was getting the same error and then saw your question I closed all the task and run this command "npx create-react-app my-app" again it got solved!
I had the same problem so I uninstalled it globally then reinstall:-
npm uninstall -g create-react-app
npm uninstall create-react-app
Then I used npx:-
npx create-react-app project-app
Tell me if this works for you
Try this:
npm install -g npm#latest
npm install node
npm install -g yarn
yarn cache clean
npx create-react-app my-app
I had the same error sometime ago,
just make sure you don't have any space between the name of your directories folders
like Desktop/react project/my-react-app ...this is wrong
try this
Desktop/reactproject/my-react-app ... correction
Describe the bug
npx create-react-app my-app doesn't work for me
i tried npm cache clean --force but i get the same error again and again
Steps to reproduce
npm cache clean --force
npm / npx create-react-app front
npm init react-app front
npx: installed 98 in 37.068s
Creating a new React app in /home/h4kst3r/Desktop/APIs/restaurant-API/front.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
npm ERR! Unexpected end of JSON input while parsing near '...zAJNgZjZUkJ08ybAxwNnR'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/h4kst3r/.npm/_logs/2020-05-20T20_47_49_189Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts cra-template has failed.
Deleting generated file... package.json
Deleting front/ from /home/h4kst3r/Desktop/APIs/restaurant-API
Done.
System:
OS: Linux 5.4 Ubuntu 20.04 LTS (Focal Fossa)
Its happened because of slow internet . So wait till ur internet connection is normal. Or install all dependencies one by one
.
If npx create-react-app my-app command not working and throws an error like: npm ERR! Unexpected end of JSON input while parsing near '...zAJNgZjZUkJ08ybAxwNnR', Just check your npm version:
npm --version
npm -v
and if required update it:
npm install -g npm#latest
It will definitely work.
First check for npm version by running the following command npm --version. if you have an npm version then try instally npx globally with the help of npm i -g npx. if npm and ngx are installed properlly then this will work .
sudo npm i -g npx --force worked for me.
You should do it as a root user. Open your terminal and type sudo -i or sudo -s. After successful login, the $ prompt would change to # to indicate that you logged in as a root user on Ubuntu. Then if you use `create-react-app it should actually work :)
There are probably two things that can be at fault.
Poor internet connection.
outdated npm version.
update your npm and seek a strong internet connection.
*npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! github#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the github#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:*
or sometimes I am different kind of errors just after creating the app. which means no modifications to the default automatic generated project.
and I managed to solved it.
the issue seems to be with my Yarn. incomplete uninstall or something like that. can't solve it by just reinstalling Yarn or uninstall it again. because of that, NPM create-react-app also create bugs, which IDK how.
but the solution is amazing, I just created the project in a different folder. trust me I'm not lying , different location do works in NPM. so I believe I need to format my computer to solve this 100%.
The cause maybe due to I have installed create-react-app via NPM globally and tries to install Yarn create-react-app.
anyway, by using a different folder location, my issue was fixed completely.
I have gone through all the questions regarding this issue but I cannot seem to find anything that works.
I am getting this error :-
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass#4.11.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass#4.11.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
I have tried to remove the node_modules and npm install again. I also tried to remove the node-sass folder in the node_modules and npm install -g node-sass#latest did not work too. I also tried
npm install -g node --unsafe-perm=true --allow-root
and
npm uninstall node-sass
npm cache clean --force
npm install -g node-sass#latest
but nothing seems to be working at all. Is there someone who can shed some light on this please?
Thanks for your time
Unless you're working on some sort of shared project that has strict requirements you can do the following to overcome the issue:
1.) Delete your package.lock file - which indicates the versions to be locked at.
2.) Delete your node_modules folder which contains all the original installations and C++ binary compilations.
3.) Then npm install it all back and npm rebuild for good measure.
It looks like this is documented on the Node-Sass page in NPM. Upgrade to Node-Sass v 4.12.0 and it will work with Node 12.
try this command it should work successfully
sudo npm install -g --unsafe-perm node-sass
it work for me
Following steps worked for me.
Remove node_modules folder.
Remove package-lock.json file.
Run sudo npm install -g --unsafe-perm node-sass
Run npm install without sudo command.
After battling with this issue for a considerable amount of hours, I downgraded from the Current version of Node (12.8.0) to the LTS (10.16.2) and it finally worked. So if you are having issues like mine, maybe try to downgrade the node version and it can help you
This is because of your incompatible node version with the node-sass module
by the way node-sass is deprecated.
check this link and select the best version with your node installed
https://www.npmjs.com/package/node-sass
just use following command.
npm update
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...
uglifyjs-webpack-plugin#0.4.6 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>
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>
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?
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.
I suspect NPM has an issue. However, this was how I was able to resolve it
Follow this steps:
npm install -g yarn
yarn global add create-react-app
Create-react-app <projectname>
npm cache clean --force
Then try
npm create-react-app navigate
I also faced same issue and I rectified it using the comment
given below:
npm cache clean --force
After this comment try:
npx create-react-app project_name
Just run this one command to resolve issue:
sudo chown -R 1001:1001 "/home/<user_name>/.npm"
This is due to the network issues try to download all dependency one by one or try to clean cache "npm cache clean --force" after this try to create an app
npx create-react-app <app__name>. But your internet connection should be stable.
I tried the npm cache clean --force and the yarn route but, neither worked. What worked for me was running Powershell as Administrator then entering:
set-executionpolicy remotesigned
try this
npm install -g yarn
yarn global add create-react-app
create-react-app my-app
I had the same problem and this was solved to me with these steps:
Be sure that you have the lastest version of Node.js installed. (https://nodejs.org/)
npm install -g create-react-app
create-react-app client-app --use-npm or npx create-react-app client-app --use-npm
i hope it helped..
this should work
npm cache clean --force
I was also facing the same issue, here is how I fixed it :
1. I first cleaned my cache using the --force keyword
2. I reinstalled create-react-app globally
3. I recreated my app.
Illustration:
clean your cache
npm cache clean --force
Reinstall create-react-app globally
npm i -g create-react-app
Recreate your app
create-react-app .
This is what I did
npm install -g yarn
then this
npx create-react-app my-project
For me, i wasn't connected to the internet when i tried to run 'create-react-app', so i connected and tried it, it worked, i'm guessing it needed to install some packages from the internet.
Creating a new React app in C:\Users\CM\Downloads\react\github-profile.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! path C:\Users\CM\AppData\Roaming\npm-cache_cacache\content-
v2\sha512\36\c6\c3e97514319bc1c6d40026e58325e782e1016c996b1fa335b1
0893d67f7339e4af62bb688c0da2aaca839d4c9d51e2eb015eec65545008a3cad93d00f806
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall lstat
npm ERR! Error: EPERM: operation not permitted, lstat
'C:\Users\CM\AppData\Roaming\npm-cache_cacache\content-
v2\sha512\36\c6\c3e97514319bc1c6d40026e58325e782e1016c996
b1fa335b10893d67f7339e4af62bb688c0da2aaca839d4c9d51e2eb015eec6
5545008a3cad93d00f806'
npm ERR! { [Error: EPERM: operation not permitted, lstat
'C:\Users\CM\AppData\Roaming\npm-cache_cacache\content-
v2\sha512\36\c6\c3e97514319bc1c6d40026e58325e782e1016c996b1f
a335b10893d67f7339e4af62bb688c0da2aaca839d4c9d51e2eb015eec6554500
8a3cad93d00f806']
npm ERR! cause:
npm ERR! { Error: EPERM: operation not permitted, lstat
'C:\Users\CM\AppData\Roaming\npm-cache_cacache\content-
v2\sha512\36\c6\c3e97514319bc1c6d40026e58325e782e1016c996b1
fa335b10893d67f7339e4
af62bb688c0da2aaca839d4c9d51e2eb015eec65545008a3cad93d00f806'
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'lstat',
npm ERR! path:
npm ERR! 'C:\Users\CM\AppData\Roaming\npm-cache\_cacache\content-
npm ERR! stack:
npm ERR! 'Error: EPERM: operation not permitted, lstat
'C:\Users\CM\AppData\Roaming\npm-cache\_cacache\content-
v2\sha512\36\c6\c3e97514319bc1c6d40026e58325e782e1016c996
b1fa335b10893d67f7339e4af62bb688c0da2aaca839d4c9d51e2eb015
eec65545008a3cad93d00f806'',
npm ERR! errno: -4048,
npm ERR! code: 'EPERM',
npm ERR! syscall: 'lstat',
npm ERR! path:
npm ERR! 'C:\Users\CM\AppData\Roaming\npm-cache\_cacache\content-
v2\sha512\36\c6\c3e97514319bc1c6d40026e58325e782e1016c996b1fa335
b10893d67f7339e4af62bb688c0da2aaca839d4c9d51e2eb015eec65545008a3cad93
d00f806',
npm ERR! parent: 'postcss-image-set-function' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It's possible that the file was already in use (by a
text editor or antivirus),
npm ERR! or that you lack permissions to access it.
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-
check thenpm ERR! permissions of the file and its containing directories, or
try running
npm ERR! the command again as root/Administrator (though this is not
recommended).
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\CM\AppData\Roaming\npm-cache_logs\2019-03-22T10_
27_19_722Z-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 github-profile/ from C:\Users\CM\Downloads\reactDone.``
i was facing similar error but i tried to run create-react-app command many times and finally it was created , this was the problem with my internet connection. check your inernet connection
I also encountered with the same problem, According to the error, you have a problem with your npm.
Try this command
sudo chown -R 1000:1000 "<location of npm>/.npm"
just take an example of my command
sudo chown -R 1000:1000 "/home/vidit/.npm"
All you need is npm cache clean --force
Works 100%
In my case, it happened when I aborted a wrong command I initiated.
Then I ran npm cache clean --force and the cache was cleaned; after that, I ran my npx create-react-app and it worked perfectly as it should.
Quick tip: Uninstall create-react-app from your machine like so, npm un -g create-react-app and run npx create-react-app instead of npm create-react-app any time you want to create a new react app.
Reason: npx will always use the latest version of create-react-app to create a new react app for your project, and npx uninstalls/removes the create-react-app package from your machine when it's done.
Don't worry, it takes about 20 seconds to install the create-react-app package, so...
Do not forget to npm cache clean --force when npx create-react-app goes bananas (i.e. refuses to work).
I faced the same problem, and I did these to solve the problem;
npm clean cache --force..
this didn't work... I returned a warning npm WARN using --forcing recommended protection disable.
I ignored that and did and reinstalled create-react-app globally by running;
npm i -g create-react-app
I created my app(project name) by running;
create-react-app my-app-name
I believe this should work for you..
I face the same issue.
I Try this But it does not work for me
npm cache clean --force
So uninstall Node
and install the latest version. It's worked for me
Hope it works for you :)
I resolved the same issue by changing the timeout time to greater than 30000
npx create-react-app appname -timeout=90000
In my case, none of the above mentioned worked for me. What fixed the problem was updating the npm:
npm install npm#latest -g
I did this because in the new LTS version (16.15.1) of NodeJS, npm was updated from 8.5.5 to 8.13.2.
just instead using the git-bash as a terminal use Windows powershell as a terminal it will work
in your system go to this location
C:\Users\user\AppData\Roaming
and inside that you will find a folder named "npm" delete that folder
and try npx create-react-app command again. conform it will work
My problem was similar and unlike others cleaning cache by using (npm cache clean --force) wasn't working out for me
this helped me instead
npx create-react-app my-app --use-npm
hope this does the trick for anyone who isn't getting result from cleaning cache
This worked for me
run npm install -g create-react-app (it will install create-react-app globally)
then create your app by running npx create-react-app [project-name]
This was my error:
3695 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\****\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "--save-exact" "--loglevel" "error" "react" "react-dom" "react-scripts"
3696 verbose node v6.10.3
3697 verbose npm v6.4.1
3698 error code Z_BUF_ERROR
3699 error errno -5
3700 error zlib: unexpected end of file
This solved the issue:
npm cache clean --force and ran create-react-app my-app