第一步:全局安装:
npm i create-react-app -g
报错: npm WARN deprecated tar@2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
(原因:tar版本过低,升级版本)
解决方法:
npm install -g tar
依旧不行,确认node版本>=14.0.0,npm版本>=5.6,并切换到想创建项目的目录:(使用该方法直接跳到第三步)
npx create-react-app react_staging
成功:
第二步:切换到想创建项目的目录,使用命令:
create-react-app react-staging
react-staging 为项目名,可任意命名(最好不要使用特殊字符、中文)
成功:
第三步:进入项目文件夹:
cd react-staging
##第四步:启动项目:
npm start
搭建成功: