从create-react-app创建项目后,运行npm run eject报错解决方法

create-react-app命令创建一个react项目,运行npm run eject生成配置文件,报了下面的错:

NOTE: Create React App 2+ supports TypeScript, Sass, CSS Modules and more without ejecting: https://reactjs.org/blog/2018/10/01/create-react-app-v2.html

√ Are you sure you want to eject? This action is permanent. ... yes
This git repository has untracked files or uncommitted changes:

主要问题是脚手架添加.gitgnore文件,但是却没有本地仓库,按照以下顺序就可以正常使用:

create-react-app app-demo
cd app-demo
git init
git add .
git commit -m 'Saving before ejecting'
npm run eject

 

你可能感兴趣的:(React,Ant,Design,reactjs,前端)