I\'m trying to run the React server by running npm start
When I do this I get a missing script error:
λ npm start
npm ERR! missing scrip
This problem has created and still is creating a lot of headaches:
https://github.com/facebook/create-react-app/issues/8308
https://github.com/facebook/create-react-app/issues/8086
Basically the suggestion is correct, may be you have an old version of something around, first try to remove the global create-react-app
npm uninstall -g create-react-app
Then try to update the npm and all the packages.
npm install -g npm@latest
Then you can run to create react app again.
npx create-react-app my-app
This has solved the issue in my case
global installs of create-react-app are no longer supported.
do it:
npm uninstall -g create-react-app
now do it:
npm install create-react-app
now create your app
npx create-react-app yout-app-name
Check the names of the scripts in the package.json file, they may be called something different to start. e.g. this part:
"scripts": {
"build": "cd packages/react-scripts && node bin/react-scripts.js build",
"start": "cd packages/react-scripts && node bin/react-scripts.js start",
},
Also, try printing your working directory using pwd and check to see if the current directory is correct and run npm run start again.
I had this problem and managed to fix it by removing the create-react-app
with this the npm uninstall -g create-react-app
command. This ensured that the npx
would always use the latest create-react-app
version.
Installing create-react-app globally is now discouraged. Instead uninstall globally installed create-react-app package by doing: npm uninstall -g create-react-app
(you may have to manually delete package folder if this command didn't work for you. Some users have reported they had to delete folders manually)
Then you can run npx create-react-app my-app
to create react app again.
ref: https://github.com/facebook/create-react-app/issues/8086
Just in case. From the docs:
If you've previously installed create-react-app globally via npm install -g create-react-app, we recommend you uninstall the package using npm uninstall -g create-react-app to ensure that npx always uses the latest version.