创建react项目

110 阅读1分钟

遇到一个创建的问题,用create-react-app demo命令创建项目,只生成了node_modules和package.json,效果如图:

有一个提示信息没有截图,大概意思是创建的命令更改了,如果需要初始项目结构并安装可传递依赖项应该执行别的命令。

创建命令:

npx create-react-app my-app

npm init react-app my-app

yarn create react-app my-app

如果还是没有初始项目结构可以eject项目

有两个途径可以查看创建命令:
1、create-react-app 官方文档:create-react-app.dev/docs/gettin…

2、去GitHub官网搜create-react-app