运行 "npm run eject" 错误。错误 'Remove untracked files, stash or commit any changes, and try again.'

Error with run "npm run eject". Error 'Remove untracked files, stash or commit any changes, and try again.'

我已经尝试了很多方法来解决这个错误。

命令:'npm run eject'

Remove untracked files, stash or commit any changes, and try again.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! devportalfrontend@0.1.0 eject: `react-scripts eject`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the devportalfrontend@0.1.0 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!     /home/deep/.npm/_logs/2018-02-18T17_05_02_924Z-debug.log

如何帮助解决这个问题..

我试过这个命令,它成功了:

git add .
git commit -am "Save before ejecting"

然后重试。

卸载 react-scripts 并安装 react-scripts-cssmodules 解决了问题

npm uninstall react-scripts

然后

npm install react-scripts-cssmodules

然后

 npm run eject

添加 git 更改

git add .
git commit -am "Save before ejecting"

检查以下拖曳选项是否适合您:

  • 卸载并重新安装 react-scripts-cssmodules :

    npm 卸载 react-sctipts

    npm 安装 react-scripts-cssmodules

    npm 运行 弹出

  • 提交 GIT 存储库的更改 :

    git 添加 .

    git commit -am "Save before ejecting"

如果上述两种解决方案中的任何一种都不起作用,并且如果Git对于您当前的项目来说不是必需的,那么请转到

控制面板 -> 程序 -> Select "Git" 然后 UN-INSTALL.

现在 运行 再次“npm 运行 弹出”。

现在应该可以正常工作了。 您可以继续并在必要时重新安装 GIT

这在消息中表示您有未跟踪的文件,这意味着它们未被您的 VCS 监控。因此在弹出之前添加并提交它们。

如果您使用的是Visual Studio代码:

  • 只需单击放大镜按钮下方的第三个图标(源代码管理)
  • 然后单击勾号,如果它要求自动暂存您的更改,请单击是
  • 添加你的提交信息然后你就完成了

再次尝试弹出,

npm run eject

应该可以正常工作。快乐黑客!

离开项目前只需提交 bc commit 是必要的

PC MINGW64 ~/react/react2/myapp (master)
$ git commit -am "first commit for before ejecting"

然后用这个命令弹出

$ npm run eject

是因为你有修改过的文件

因此启动新的 git 存储库

git init

然后将所有文件添加到 git

git add .

添加后提交文件

git commit -am "Saving before ejecting"

现在您可以使用以下命令弹出项目

npm run eject

快乐编码!!!!!!!

就我而言,我在这里找到了解决方案。

关注这可能对您有所帮助。

第一步。

create-react-app yourProjectName

第 2 步。

cd yourProjectName

步骤 3.

npm uninstall react-scripts

第 4 步。

npm install react-scripts-cssmodules

第 5 步

git init

第 6 步。

git add .

第 7 步。

git commit -am "ejecting"

第 8 步。

npm run eject

您需要在 运行 弹出之前提交更改:

git add .
git commit -am "change messages before running eject"

现在,试试

npm run eject

只需删除项目中的git文件,然后运行命令:npm 运行 eject

在 macOS 中,如果您导航到项目文件夹内部

CMD + SHIFT + .

这将显示隐藏文件。

1,git 初始化和 git 添加 . 2、git commit -m 'before eject' 3、纱线弹出

  • 列表项

如果该代码不能解决问题,您可以 1、npm卸载react-scripts 2、npm安装react-scripts-cssmodules 3、代码前执行

截至今天,对我有用的是 expo eject