react eject提示This git repository has untracked files or uncommitted changes:
在yarn eject 但时 老是提示This git repository has untracked files or uncommitted changes:
Remove untracked files, stash or commit any changes, and try again.
D:\react>yarn eject
yarn run v1.22.10
$ react-scripts 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:
package.json
M src/index.js
M yarn.lock
.eslintcache
src/pages/
Remove untracked files, stash or commit any changes, and try again.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
这时为什么呢,原因是在创建脚手架时添加了.gitgnore文件,但是却没有本地仓库,所以要初始化一个本地库。这样操作后,我们就可以看到如下运行成功的结果了:
git init
git add .
git commit -m 'init'
npm run eject 或者 yarn eject
这样就会看见执行成功了
好执行成功再看看
项目目录中已经多出来一个config 文件了这个就可以开始进行webpack配置了