Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Missing Script when I run npm start to create React app

Tags:

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 script: start  npm ERR! A complete log of this run can be found in: npm ERR!     C:\Users\Aristophanes\AppData\Roaming\npm-cache\_logs\2019-05-15T11_34_47_404Z-debug.log 

Full error log:

0 info it worked if it ends with ok 1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe', 1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js', 1 verbose cli   'start' ] 2 info using [email protected] 3 info using [email protected] 4 verbose stack Error: missing script: start 4 verbose stack     at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:155:19) 4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:63:5 4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:115:5 4 verbose stack     at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:418:5 4 verbose stack     at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:373:45) 4 verbose stack     at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:416:3) 4 verbose stack     at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:160:5) 4 verbose stack     at ReadFileContext.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:332:20) 4 verbose stack     at ReadFileContext.callback (C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16) 4 verbose stack     at FSReqCallback.readFileAfterOpen [as oncomplete] (fs.js:242:13) 5 verbose cwd C:\Users\Aristophanes\eth-todo-list-react 6 verbose Windows_NT 10.0.17134 7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start" 8 verbose node v11.1.0 9 verbose npm  v6.4.1 10 error missing script: start 
like image 634
Aristophanes Avatar asked May 15 '19 11:05

Aristophanes


People also ask

What happens when you run npm start react?

With the start argument, NPM will begin the process to make a development server available for your React application. Here's a list of tasks for this script: Set the build environment into development for Node and Babel. Ensure environment variables are read for the build process.

Why npm start is not working?

Check the ignore-script config If you see the start script is present inside your package. json file but still can't run the script, you need to check the console output. If there's no output at all, then you may have the ignore-scripts npm configuration set to true .

Can I use npm With create-react-app?

Prerequisites. In order to create React application, you will need to have a Node that is >= 14.0. 0 and npm >= 5.6. As we discussed earlier npm is a package manager that comes with Node.

What is start react-scripts start?

start. React uses Node. js on development to open the app on http://localhost:3000 , thus the start script enables you to start the webpack development server. You can run the start script command on the terminal with either npm or yarn : yarn start npm start.


2 Answers

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

like image 175
Márcio Soares Avatar answered Sep 20 '22 15:09

Márcio Soares


Installing create-react-app globally is now discouraged. Instead uninstall globally installed create-react-app package by doing: npm uninstall -g create-react-app (may require run as sudo if you get permission related errors or 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.

npx is available for npm version >= 5.2

ref: https://github.com/facebook/create-react-app/issues/8086

like image 44
Shinebayar G Avatar answered Sep 22 '22 15:09

Shinebayar G