createreact应用程序在安装yarn和npx后无法工作



我是一个新的mac用户,我刚买了一台mac m1,遇到了一个奇怪的问题。当我尝试运行命令时,我安装了yarn v3

yarn create-react-app app 

它给了我这个错误

Usage Error: The project in /Users/home/package.json doesn't seem to have been installed - running an install there might help

‘create-react-app’是一个工具包,可以用一些样板代码快速创建react应用程序。

您可以通过两个步骤创建React应用程序:

步骤1:安装创建反应应用

步骤2:使用create-react应用程序创建您的应用程序。

对于步骤1:要安装create-react应用程序,请使用以下命令:

yarn global add create-react-app

对于步骤2:要使用它来创建您的React应用程序:

create-react-app app

您也可以在不全局安装"创建反应应用程序"包的情况下创建应用程序:

npx create-react-app <app name>

供您参考:https://reactjs.org/docs/create-a-new-react-app.html#create-react应用

最新更新