环境:Mac系统,我随便在任何一个地方使用create-react-app命令创建一个项目,运行npm run eject命令暴露配置文件都报这个错误。git提交?怎么会这样呢,我什么都还没弄,才刚创建项目就让我提交git? 而且还是在这个项目根目录之外的文件。
This git repository has untracked files or uncommitted changes:
Remove untracked files, stash or commit any changes, and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! react-app@0.1.0 eject: react-scripts eject
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the react-app@0.1.0 eject script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output abo
解决方法:
先
git add .
然后
git commit -m "init"
然后再npm run eject
eject之后好多装过的东西会报错,这时需要删除node_modules重新npm install,就可以了