为什么 yarn create react-app ./ 不起作用?

huangapple go评论65阅读模式
英文:

Why is yarn create react-app ./ not working

问题

PS C:\Users\Lewis Wachira\OneDrive\Desktop\Snack Shark Restaurant> cd client
PS C:\Users\Lewis Wachira\OneDrive\Desktop\Snack Shark Restaurant\client> yarn create react-app ./
成功安装 "create-react-app@5.0.1" 并创建可执行文件:create-react-app
'C:\Users\Lewis' 不被识别为内部或外部命令、可操作的程序或批处理文件。
错误,命令失败。
退出码:1
命令:C:\Users\Lewis Wachira\AppData\Local\Yarn\bin\create-react-app
参数:./
目录:C:\Users\Lewis Wachira\OneDrive\Desktop\Snack Shark Restaurant\client
输出:
信息:访问 https://yarnpkg.com/en/docs/cli/create 以获取有关此命令的文档。

我正在尝试在客户端文件夹中创建一个React应用程序,但出现错误。我运行的第一个命令是:

  1. cd client

然后我运行了

  1. yarn create react-app ./
英文:
PS C:\Users\Lewis Wachira\OneDrive\Desktop\Snack Shark Restaurant> cd clientPS C:\Users\Lewis Wachira\OneDrive\Desktop\Snack Shark Restaurant\client> yarn create react-app ./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'C:\Users\Lewis' is not recognized as an internal or external command,operable program or batch file.error Command failed.Exit code: 1Command: C:\Users\Lewis Wachira\AppData\Local\Yarn\bin\create-react-appArguments: ./Directory: C:\Users\Lewis Wachira\OneDrive\Desktop\Snack Shark Restaurant\clientOutput:
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.

I'm trying to create a react app in my client folder but I'm getting an error. The first command I ran was:

  1. cd client

Then I ran

  1. yarn create react-app ./`

答案1

得分: 1

我认为你应该运行以下命令:

yarn create react-app .

如果你不能使用yarn,我建议你尝试使用npx或npm,就像这样:

npx create-react-app .

或者

npm init react-app .

这里的```.```指定了初始化React应用的位置。
英文:

I think you should instead run

yarn create react-app .

If you can't do it with yarn, I'll suggest you to try with npx or npm, like this:

npx create-react-app .

or

npm init react-app .

That . specifies the location for the react app to be initialized.

huangapple
  • 本文由 发表于 2023年5月15日 00:13:46
  • 转载请务必保留本文链接:https://go.coder-hub.com/76248497.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定