kruchkamgar
kruchkamgar

Reputation: 65

eject command not found in create-react-app -- how to add to package.json?

I get this error after installing create-react-app, and trying to run "npm run eject"

eject: command not found.

How do I edit package.json to run the command I found in the documentation?

Upvotes: 0

Views: 2386

Answers (4)

Astik Sarathe
Astik Sarathe

Reputation: 21

Instead of npm try with npx

npx react-scripts eject

Above command worked for me.

Upvotes: 2

zawhtut
zawhtut

Reputation: 8561

You have to install

https://github.com/ramyareye/react-native-eject

yarn add react-native-eject
yarn react-native eject

Upvotes: 1

kruchkamgar
kruchkamgar

Reputation: 65

facebook's github indicates that the global install of create-react-app would interfere with CRA installation; and so I ran:

npm rm -g create-react-app

as suggested on facebook's github here:

https://github.com/facebook/create-react-app/issues/8088#issuecomment-562189517

(and then reinstall CRA)

Upvotes: 1

kruchkamgar
kruchkamgar

Reputation: 65

I found a work-around: run the script, manually, found in node_modules/react-scripts/scripts/eject.js.

node ./node_modules/react-scripts/scripts/eject.js

Upvotes: 1

Related Questions