16

I Reinstalled Node.js and Yarn. Now I am getting this error.

My environment information is:

Node: v8.12.0

NPM: 6.4.1

Yarn: 1.10.1

OS: Windows 10

PS C:\Users\mdbel\Desktop\Project\redux> npx create-react-app learnredux

Creating a new React app in C:\Users\mdbel\Desktop\Project\redux\learnredux.

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

yarn add v1.10.1
[1/4] Resolving packages...
[2/4] Fetching packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/@xtuc/long/-/long-4.2.1.tgz: Request failed \"404 Not Found\"".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\mdbel\\Desktop\\Project\\redux\\learnredux\\yarn-error.log".
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\mdbel\Desktop\Project\redux\learnredux has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Done.
Community
  • 1
  • 1
Belal
  • 415
  • 2
  • 5
  • 18

18 Answers18

30

Once you have cleaned the yarn cache by running:

yarn cache clean

then subsequent calls to:

npx create-react-app your-app

will work.

Ben Smith
  • 19,589
  • 6
  • 65
  • 93
28

I had same issue and solved it by:

Installing latest version of node, npm and yarn.

npm install -g npm@latest
nvm install node
npm install -g yarn

nvm installs Node.js and npm manages packages.

Deke
  • 4,451
  • 4
  • 44
  • 65
9

I solved this problem by deleting .yarnrc file from C:\Users\yourUserName\

ArsTV
  • 321
  • 3
  • 5
8

removing .npmrc from C:\Users\you\.npmrc can also solve the problem.

Belal
  • 415
  • 2
  • 5
  • 18
5

I had a same problem then i tried the below Command and it fixed my issue

npm cache clean --force

The above command didn't solved your problem then try the below one.

npm init -y
npx create-react-app your-app-name
4

I faced the same issue when using npx and was able to resolve this with the following steps:

  • Upgraded to latest yarn version: $ npm i @yarn@latest
  • Remove node_modules folder
  • Remove yarn.lock (if it exists).
  • Remove .npmrc from your user folder.

If the issue still persist you can use yarn command instead : $ yarn create react-app learnredux

yarn create is available in Yarn 0.25+

Melchia
  • 22,578
  • 22
  • 103
  • 117
4

updating to latest stable version of yarn and removing yarn cache folder in the AppData folder has solved my issue C:\Users\test\AppData\Local\Yarn

3

I had the same error on my Mac.

I just re-downloaded the installer from the Node.js website. This should reinstall all the dependencies and make sure that all paths are valid.

https://nodejs.org/en/download/

RawBData
  • 207
  • 4
  • 4
3

This might help for Linux operating system

sudo npm install -g npm@latest
npm install node
npm init
npm install -g yarn
yarn cache clean
npx create-react-app my-app
Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
Mebatsion Sahle
  • 409
  • 2
  • 9
2

I also resolved my issue by installing the latest version of node from

https://nodejs.org/en/download/

And then i run below command

npm install -g create-react-app

in the terminal Followed by "create-react-app " or "create-react-app ." if you are already in the folder.

Avinash Dalvi
  • 8,551
  • 7
  • 27
  • 53
2

Try this!

npm install -g npm@latest  

npm install node


npm install -g yarn


npx create-react-app appname

cd firstapp

yarn start
Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
Abhilasha
  • 46
  • 2
1

Update node modules to version 13.12.0 that works for me

https://nodejs.org/es/download/current/

Mario
  • 11
  • 1
0

Yes, I have the same issue and I am unable to solve but after uninstalling yarn and updating node with the latest version.

Also, make sure you have installed

npm i -g create-react-app

after updating the packages.

Clean the cache also to make it free from bugs this will definitely work

dgg32
  • 1,409
  • 1
  • 13
  • 33
amisha
  • 1
0

Best method for windows user is update your yarn If you use npx and got error than update yarn then use npx I have same error in windows 8.1 then I updated yarn and it solved my problem

Npm I yarn@latest
npx creat-react-app  app name
Tshilidzi Mudau
  • 7,373
  • 6
  • 36
  • 49
0

I encountered the same problem. It seems that this occurs when npm and node installation is broken. However, sometimes clearing cache doesn't work. I had to not just uninstall but delete/purge all npm and node files on my system, and reinstall them back again.

Remove node and npm

sudo rm -rf /usr/local/lib/node_modules
sudo rm -rf ~/.npm

sudo apt remove --purge npm
sudo apt remove --purge node
sudo apt remove --purge nodejs

Check if npm and node are removed by running: which node and which npm If you still see some folders, try removing them using:

sudo apt-get remove nodejs
sudo apt-get remove npm

Update system, just in case

sudo apt-get update

Install node and npm

sudo apt-get install nodejs
sudo apt-get install npm

Check installation

npm -v
node -v

Note: The steps here involve removing existing modules and putting them back again. I also had to manually uninstall nodejs using Programs and Features (for Windows).

0

I accidentally hid the .yarnrc file and that caused the problem.

Sttatusx
  • 11
  • 4
0

Re-installing node to the latest version worked for me.

https://nodejs.org/en/download/

-1

I had the same problem. Instead of yarn you can use npm to create the app. Just add the --use-npm flag so:

npx create-react-app app --use-npm
seshadri_c
  • 6,906
  • 2
  • 10
  • 24