【React脚手架安装】用yarn命令:yarn create react-app myapp 显示错误:error Command failed.

问题

安装React脚手架时使用yarn create react-app my app命令显示如下错误。

engguilideMacBook-Pro:textApp zengguili$ yarn create react-app myapp
yarn create v1.22.19
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...

success Installed "create-react-app@5.0.1" with binaries:
      - create-react-app

Creating a new React app in /Users/zengguili/textapp/myapp.

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

yarn add v1.22.19
info No lockfile found.
[1/4] 🔍  Resolving packages...

 //省略若干代码
Error: Couldn't find package "postcss-value-parser@^4.2.0" required by "postcss-overflow-shorthand@^3.0.4" on the "npm" registry.
//省略若干代码
Error: Couldn't find package "postcss-value-parser@^4.1.0" required 

Deleting generated file... package.json
Deleting myapp/ from /Users/zengguili/textapp
Done.
error Command failed.
Exit code: 1
Command: /Users/zengguili/.yarn/bin/create-react-app
Arguments: myapp
Directory: /Users/zengguili/textapp
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

解决办法

yarn cache clean命令清除缓存

cengguilideMacBook-Pro:textApp zengguili$ yarn cache clean
yarn cache v1.22.19
success Cleared cache.
✨  Done in 9.68s.

再重新运行:yarn create react-app myapp

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

@ZGLi

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值