Create React App 安装失败,显示错误并且中止安装。

35 浏览
0 Comments

Create React App 安装失败,显示错误并且中止安装。

我重新安装了Node.js和Yarn。现在我遇到了这个错误。

我的环境信息如下:

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.

admin 更改状态以发布 2023年5月21日
0
0 Comments

我也遇到了同样的问题,并通过以下方式解决:

安装最新版本的node、npm和yarn。

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

nvm 安装Node.js和npm管理包。

0
0 Comments

当你运行以下命令来清理yarn缓存:

yarn cache clean

然后,对以下命令的后续调用:

npx create-react-app your-app

将会正常运行。

0