简体   繁体   English

安装 yarn 和 npx 工作后 create-react-app 不工作

[英]create-react-app not working after installing yarn and npx working

I am a new mac user I just have bought a mac m1 and I have a strange problem.我是一个新的 mac 用户,我刚买了一个 mac m1,我遇到了一个奇怪的问题。 i have yarn v3 installed when i try to run command当我尝试运行命令时,我安装了 yarn v3

yarn create-react-app app 

it gives me this error它给了我这个错误

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' is a toolkit to quickly create a React app with some boilerplate code. 'create-react-app' 是一个使用一些样板代码快速创建 React 应用程序的工具包。

You can create a React app in 2 steps:你可以通过 2 个步骤创建一个 React 应用程序:

Step 1: install create-react-app第 1 步:安装 create-react-app

Step 2: use create-react-app to create your app.第 2 步:使用 create-react-app 创建您的应用程序。

For step 1: To install create-react-app use the following command:第 1 步:要安装 create-react-app,请使用以下命令:

yarn global add create-react-app

For step 2: To use this to create your React app:对于第 2 步:要使用它来创建您的 React 应用程序:

create-react-app app

You can also create the app without globally installing the 'create-react-app' package:您也可以在不全局安装“create-react-app”package 的情况下创建应用程序:

npx create-react-app <app name>

For your reference: https://reactjs.org/docs/create-a-new-react-app.html#create-react-app供您参考: https://reactjs.org/docs/create-a-new-react-app.html#create-react-app

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM