【问题标题】:create-react-app - installation being abortedcreate-react-app - 安装被中止
【发布时间】:2019-06-17 18:57:51
【问题描述】:

我在使用创建 React 应用程序时遇到问题,我不断收到错误消息。 我正在使用节点 v10.16.0 和 npm v 6.9.0

我已经浏览了很多答案,并尝试了所有建议,包括重新安装节点、清除缓存等。

我在命令提示符中输入了npx create-react-app client

这就是我得到的。


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

yarn add v1.16.0
[1/4] Resolving packages...
error Received malformed response from registry for "react". The registry may be down.
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\xxxx\Documents\Work Project\client has failed.

Deleting generated file... package.json
Deleting generated file... yarn.lock
Deleting client/ from C:\Users\xxxx\Documents\Work Project
Done.

【问题讨论】:

  • 使用yarn代替npm安装包
  • npx create-react-app client 在这里为我工作得很好(相同的节点和 npm 版本,但在 mac 上)。也许是你所在的网络?试试别的电脑?
  • 使用纱线给我这个错误error Received malformed response from registry for "mobx-react". The registry may be down.
  • 似乎您正在将纱线与 npm 混合使用。创建一个新文件夹,然后仅使用 npx create-react-app 项目名称
  • 我得到了与上面我的问题中写的相同的错误。

标签: reactjs npm create-react-app


【解决方案1】:

一旦你通过运行清理了纱线缓存:

yarn cache clean

删除 AppData 文件夹中的纱线缓存文件夹以及 C:\Users\test\AppData\Local\Yarn

随后调用:

npx create-react-app your-app

这对我很有效

【讨论】:

    猜你喜欢
    • 2020-05-28
    • 2019-07-25
    • 2017-09-11
    • 2018-10-04
    • 1970-01-01
    • 2021-09-11
    • 2020-11-13
    • 2020-11-21
    • 1970-01-01
    相关资源
    最近更新 更多