使用從create-react-app創建項目後,運行npm run eject報錯解決方法

使用create-react-app命令創建一個react項目,運行npm run eject生成配置文件,報了下面的錯:

Remove untracked files, stash or commit any changes, and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] eject: `react-scripts eject`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] eject script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\lenovo\AppData\Roaming\npm-cache\_logs\2018-11-01T04_03_50_129Z-debug.log

主要問題是腳手架添加.gitgnore文件,但是卻沒有本地倉庫,按照以下順序就可以正常使用

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

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章