React 从零搭建项目 使用 create-react-app脚手架

一、安装

  npm install -g create-react-app

  版本校验:create-react-app --version

二、创建项目

  create-react-app指令默认调用npm,于是直接把npm的register给永久设置过来就好了,这样使用cnpm或者npm就没差别了。创建项目速度会快很多

npm config set registry https://registry.npm.taobao.org
-- 配置后可通过下面方式来验证是否成功
npm config get registry
-- 或npm info express

  create-react-app my-app

  cd my-app/

  npm start

  通过http://localhost:3000/查看你的app

  使用 npm run build 编译打包程序

猜你喜欢

转载自www.cnblogs.com/LChenglong/p/11112568.html