Skip to content

Ejecting crashes if no devDependencies exists in package.json #2655

Closed
@geelen

Description

@geelen

Just hit a bug where yarn eject (or npm run eject) fails with the following message:

TypeError: Cannot read property 'react-scripts' of undefined
    at inquirer.prompt.then.answer (node_modules/react-scripts/scripts/eject.js:149:36)
    at <anonymous>

Here's the line in question. I had moved all my devDependencies to dependencies in order for Heroku to run then in a postinstall step (more info here) and so the eject was exploding on this line. To fix, all I needed to do was:

   "version": "0.1.0",
   "private": true,
+  "devDependencies": {},
   "dependencies": {
     "react": "^15.5.4",
     "react-dom": "^15.5.4",
     "react-scripts": "^1.0.7"
   },

Not necessarily something that needs fixing, but if anyone is googling the exact error message above then this issue will hopefully guide them towards the same fix!

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions