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

  • Post author:
  • Post category:其他


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



版权声明:本文为duansamve原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。