node.js - 创建 React App 未安装,显示错误并中止安装

标签 node.js reactjs npm create-react-app yarnpkg

我重新安装了 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.

最佳答案

通过运行清理 yarn 缓存后:

yarn cache clean

然后后续调用:

npx create-react-app your-app

会起作用。

关于node.js - 创建 React App 未安装,显示错误并中止安装,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52882119/

相关文章:

javascript - 如何在 ReactJS 中设置图片 url

javascript - 为什么 `resolutions` 在与 bower.json 相同的 package.json 中不受支持

node.js - 对公共(public)类使用共享 Node 模块

node.js - 清除NodeJS中的所有cookie

node.js - 描述一下 Node.js 中的退出代码?

node.js - npm CA 证书的位置

javascript - ComponentDidUpdate SetState ReactJS 无限循环

javascript - 如何在 React 中传递多个键及其 HTML 标签属性

node.js - 无法全局安装 Node 模块。找不到模块错误

javascript - 如何运行依赖于第一个 api 中设置的变量的 api?