diff --git a/packages/react-cy-scripts/scripts/eject.js b/packages/react-cy-scripts/scripts/eject.js index 5fe911fbb23..57cf3279c51 100644 --- a/packages/react-cy-scripts/scripts/eject.js +++ b/packages/react-cy-scripts/scripts/eject.js @@ -148,13 +148,19 @@ prompt( ); console.log(); + try { + // remove react-scripts and react-scripts binaries from app node_modules + Object.keys(ownPackage.bin).forEach(function(binKey) { + fs.removeSync(path.join(appPath, 'node_modules', '.bin', binKey)); + }); + fs.removeSync(ownPath); + } catch(e) {} + if (fs.existsSync(paths.yarnLockFile)) { console.log(cyan('Running yarn...')); - fs.removeSync(ownPath); spawnSync('yarnpkg', [], {stdio: 'inherit'}); } else { console.log(cyan('Running npm install...')); - fs.removeSync(ownPath); spawnSync('npm', ['install'], {stdio: 'inherit'}); } console.log(green('Ejected successfully!'));