Ejecting when `scripts` folder already exists causes eject to fail permanently
Created by: heldinz
We ran npm run eject
and answered y
at the prompt. It logged Ejecting...
and then stopped with no further output. No config or scripts were copied over, just the new folders config/jest
.
We realised that the problem might be that we already had a folder called scripts
. We renamed this folder and re-ran the eject command, but got the same result.
I'm fairly certain that the error occurs when the eject script tries to create the scripts
folder but it could just as easily have occurred when creating the config
or config/jest
folders, had we already had existing folders with those names in our project. Although the script checks for the presence of files existing at the path it will copy them to, it does not check for the presence of the folders before creating those.
The eject script should either fail early with the error that the folder already exists (as it does with the files), or it should check for the presence of the folder before attempting to create it. Instead, it fails silently.