diff --git a/packages/react-scripts/scripts/eject.js b/packages/react-scripts/scripts/eject.js index 86dbc15c3ae..b8f9d313143 100644 --- a/packages/react-scripts/scripts/eject.js +++ b/packages/react-scripts/scripts/eject.js @@ -93,8 +93,14 @@ prompt( console.log(cyan('Updating the dependencies')); var ownPackageName = ownPackage.name; - console.log(' Removing ' + cyan(ownPackageName) + ' from devDependencies'); - delete appPackage.devDependencies[ownPackageName]; + if (appPackage.devDependencies[ownPackageName]) { + console.log(' Removing ' + cyan(ownPackageName) + ' from devDependencies'); + delete appPackage.devDependencies[ownPackageName]; + } + if (appPackage.dependencies[ownPackageName]) { + console.log(' Removing ' + cyan(ownPackageName) + ' from dependencies'); + delete appPackage.dependencies[ownPackageName]; + } Object.keys(ownPackage.dependencies).forEach(function (key) { // For some reason optionalDependencies end up in dependencies after install