Failing on fetching packages when creating react app - reactjs

I am trying to create react app using: npx create-react-app my-app
and I keep getting this error:
Creating a new React app in /Users/mcohen/Git/andys-tale/andys-blog.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.12.3
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
error https://registry.yarnpkg.com/#xtuc/ieee754/-/ieee754-1.2.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "Unexpected end of data"
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/mcohen/Git/andys-tale/andys-blog has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting andys-blog/ from /Users/mcohen/Git/andys-tale
Done.
Any suggestions what shall I do?

Delete yarn.lock file
This will help!

I'd probably desperately run yarn cache clean

Related

Error creating a React app with the command 'npx create-react-app ./client'

I'm making a video chat. Every time I create a React app with the command npx create-react-app ./client I'm having this issue. How to fix it, please?
Creating a new React app in `D:\webrtc\client`.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts with cra-template...
yarn add v1.22.10
[1/4] Resolving packages...
info There appears to be trouble with your network connection. Retrying...
[2/4] Fetching packages...
error postcss#8.2.6: The engine "node" is incompatible with this module. Expected version "^10 || ^12 || >=14". Got "13.14.0"
error Found incompatible module.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts cra-template --cwd D:\webrtc\client has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting client/ from D:\webrtc
Done.

I am trying to start a new react project But I am getting this error and the app is not created. I have installed react globally

(base) mukund#mukund-Inspiron-15-3567:~$ create-react-app todo-app
Creating a new React app in /home/mukund/todo-app.
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 '...{"babel-core":"^6.0.0'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mukund/.npm/_logs/2020-05-10T14_41_17_724Z-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 todo-app/ from /home/mukund
Done.
Creating an app like the recommended way by the core React team at reactjs.org should solve the problem.
Do this:
npx create-react-app todo-app
If that is still not working then run the following to clear your npm cache before trying the step above again:
npm cache clean --force
This just gives you a clean reset incase your cached modules are conflicting with each other.

create-react-app not working due to fetching issue

I want to create a react app although "npx create-react-app [app-name]" won't work in my project folder. I get the an "Incorrect integrity when fetching from the cache" error although I'm not familiar with why it's not fetching. The error is below.
=================================
Vincents-MacBook-Pro:Personal-Projects Vince$ npx create-react-app my-app
Creating a new React app in /Users/Vince/Documents/Coding-Projects/Personal-Projects/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.19.0
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
error Incorrect integrity when fetching from the cache
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/mountainthief/Documents/Coding-Projects/Personal-Projects/test-app has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting test-app/ from /Users/Vince/Documents/Coding-Projects/Personal-Projects
Done.
=================================
I've tried "npm cache clean --force" and uninstalling yarn to no avail.
What could I be missing?
npm cache clean --force
uninstall yarn
Creating a new React app in /Users/Vince/Documents/Coding-Projects/Personal-Projects/my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.19.0
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
error Incorrect integrity when fetching from the cache
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd /Users/mountainthief/Documents/Coding-Projects/Personal-Projects/test-app has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting test-app/ from /Users/Vince/Documents/Coding-Projects/Personal-Projects
Done.
I expected a functional React-app complete with node-modules although I received the error:
yarn add v1.19.0
[1/4] πŸ” Resolving packages...
[2/4] 🚚 Fetching packages...
error Incorrect integrity when fetching from the cache
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
You can also see where the cache is with yarn cache dir.
yarn cache dir
Running yarn cache dir will print out the path where yarn’s global cache is currently stored. When you do a
yarn cache clean
You can check the folder actually cleans. If that fails you can manually delete it. yarn cache documentation
please run both commands again then install your app. Basically this types of error coming due to some package dependencies. So please install all both packages again.
npm install -g create-react-app
and reinstall yarn
If you getting same error after install both the please send me yarn and node version.
https://www.npmjs.com/package/npx
I had the same issue and it has resolved with upgrading global yarn packages.
$ yarn global upgrade
What fixed it for me was to delete the entire global yarn cache dir in the file system which I got via yarn cache dir, here's a one liner for that:
rm -rf `yarn cache dir`
After that yarn global upgrade made it work again:
yarn create react-app my-app --typescript
Happy hacking!
✨ Done in 22.60s.
This was a simple folder permissions issue for me, a sudo resolved:
sudo npx create-react-app myApp

create-react-app - installation being aborted

I am having a problem creating a react app using, I keep getting an error.
I am using node v10.16.0 and npm v 6.9.0
I looked through many answers already and tried everything that has been suggested including reinstalling node, clearing cache etc.
I typed npx create-react-app clientinto the command prompt
and this is what I get.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.16.0
[1/4] Resolving packages...
error Received malformed response from registry for "react". The registry may be down.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Aborting installation.
yarnpkg add --exact react react-dom react-scripts --cwd C:\Users\xxxx\Documents\Work Project\client has failed.
Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting client/ from C:\Users\xxxx\Documents\Work Project
Done.
Once you have cleaned the yarn cache by running:
yarn cache clean
Removing yarn cache folder in the AppData folder as well C:\Users\test\AppData\Local\Yarn
then subsequent calls to:
npx create-react-app your-app
This works for me well

How can i correct the error i keep getting in creating a react app

Each time i tried creating a react app using create-react-app <...name> i keep getting this error "
Creating a new React app in C:\windows\system32\brian-todos.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
npm ERR! Unexpected end of JSON input while parsing near '...tXcMskoaoOolrubJ3NQGh'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BrianMartinez\AppData\Roaming\npm-cache_logs\2019-01-12T13_11_25_580Z-debug.log
Aborting installation.
npm install --save --save-exact --loglevel error react react-dom react-scripts has failed.
Deleting generated file... package.json
Deleting brian-todos / from C:\windows\system32
Done."
I even tried npm clear cache it still didn't not work.What do i do about this challenge
It seems you opened your windows console or powershell as an administrator, and you landed in system32 folder. Don't create your project there, that is a reserved folder for system executables. Do something like cd C:\Users\yourusername\Documents and try there.
This is the answer to the challenge i had before now. follow these steps
npm install -g yarn
yarn global add create-react-app
create-react-app

Resources