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

I have try lot's of things to solve this error.

Command:'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!     /home/deep/.npm/_logs/2018-02-18T17_05_02_924Z-debug.log

How can help to solve this problem..


I have tried this command it's worked:

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

and then try again.


Uninstalling react-scripts and installing react-scripts-cssmodules solved the problem

npm uninstall react-scripts

And then

npm install react-scripts-cssmodules

then

 npm run eject

Add it the git changes

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

This says in the message that you have untracked files that means that they are not being monitored by your VCS. Hence add and commit them before you eject.

If you are using Visual Studio Code:

  • Just click on the third icon (Source Control), below the magnifying glass button
  • Then click on the tick mark, if it asks to automatically stage your changes Click Yes
  • Add your commit message and then you are done

enter image description here

Try ejecting again,

npm run eject

Should work just fine. Happy Hacking!


You need to commit your changes before running eject:

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

Now, Try

npm run eject

It is because you having the changed files

so initiate the new git repo

git init

then add all files to git

git add .

once added commit the files

git commit -am "Saving before ejecting"

now you can eject the project using below command

npm run eject

Happy Coding !!!!!!!