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.
1
  • remove .npmrc from C:\Users\you\.npmrc will solve this issue. Commented Oct 19, 2018 at 9:46

18 Answers 18

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.

Sign up to request clarification or add additional context in comments.

Comments

29

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.

2 Comments

This worked best for me. npx create-react-app was no problem anymore. Thanks!
This is the correct answer. create-react-app requires Node >= 8.10 and npm >= 5.6
9

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

Comments

8

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

Comments

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

Comments

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

Comments

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+

1 Comment

removing .npmrc from C:\Users\you\.npmrc solved my problem.
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/

Comments

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

Comments

3

Try this!

npm install -g npm@latest  

npm install node


npm install -g yarn


npx create-react-app appname

cd firstapp

yarn start

Comments

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.

Comments

1

Update node modules to version 13.12.0 that works for me

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

1 Comment

How would that help?
1

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).

Comments

1

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

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

Comments

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

Comments

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

1 Comment

Please try to use a code block for the runnable command lines or code in general
0

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

Comments

0

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

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.