react 脚手架 初始化项目

  • 全局安装 yarn(Yarn是facebook发布的一款取代npm的包管理工具)
npm i yarn -g
  • 查看版本号
yarn -v
  • 全局安装react脚手架
yarn add create-react-app -g
  • 在命令行中使用初始化命令,初始化一个项目;
create-react-app 项目名称
// 或
npx create-react-app 项目名称

如果上述方法失败,出现"Incorrect integrity when fetching from the cache" ,可以使用 yarn cache clean 解决,完成之后 在重新执行 初始化命令

关于npx相关的文章可以参考阮一峰教程http://www.ruanyifeng.com/blog/2019/02/npx.html

你可能感兴趣的:(react 脚手架 初始化项目)