Create React App not installing, showing an error and aborting installation

陌路散爱 提交于 2020-02-28 01:08:27

问题


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:


Once you have cleaned the yarn cache:

yarn cache clean

then subsequent calls to:

npx create-react-app your-app

will work.




回答2:


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.




回答3:


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




回答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




回答5:


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/




回答6:


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+




回答7:


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.




回答8:


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



回答9:


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




回答10:


Try this!

npm install -g npm@latest

npm install node

npm install -g yarn

npx create-react-app appname

cd firstapp

yarn start



来源:https://stackoverflow.com/questions/52882119/create-react-app-not-installing-showing-an-error-and-aborting-installation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!