解决方案

进入项目所在的目录下,打开终端窗口,执行以下命令:

 npm run eject

可能会遇到的问题

报错一:存在未提交的文件

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

解决办法:将所有未commit的文件进行提交

报错二(不常见):npm和node版本不一致

npm WARN npm npm does not support Node.js v14.9.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm You can find the latest version at https://nodejs.org/

> test_mometa@0.1.0 eject
> react-scripts eject

现象:执行过程卡住不动,点击回车报以下错误:

√ Are you sure you want to eject? This action is permanent. ... no
Close one! Eject aborted.

解决办法:打开终端查看node和npm的版本:node -vnpm -v,然后去https://nodejs.org/zh-cn/download/releases/网站中查看node和npm的版本关系,对npm的版本进行调整npm -g install npm@6.14.8