新手使用create-react-app命令创建一个项目, 运行npm run eject报错

环境: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,就可以了

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容