3

After installing node and global create-react-app using 'npm install -g create-react-app' I start creating my first app using 'npx(or npm i tried both) create-react-app appname' and it was successfully created until I start the 'npm start' in 'appname' directory which gave me the following errors.

E:\Sang\React\myapp>npm start

myapp@0.1.0 start E:\Sang\React\myapp react-scripts-start

'react-scripts-start' is not recognized as an internal or external command, operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myapp@0.1.0 start: react-scripts-start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myapp@0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Sang Tonsing\AppData\Roaming\npm-cache_logs\2020-09-03T12_06_34_133Z-debug.log

This is my script code inside package.json

{
"name": "myfirstreact",
"version": "0.1.0",
"private": true,
"dependencies": {
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
  ">0.2%",
  "not dead",
  "not op_mini all"
],
"development": [
  "last 1 chrome version",
  "last 1 firefox version",
  "last 1 safari version"
]
}
}

Kindly please help me solve my problem, I am planning to build my own website using react. Thank You so Much

Sang Tonsing
  • 137
  • 3
  • 14

7 Answers7

0

"scripts":{
"start":"react-scripts-start",
"build":"react-scripts-build",
"test":"react-scripts-test",
"eject":"react-scripts-eject",
}

you have to go to your package.json file and look inside scripts, you should see there start script. if you dont have just add it.

Orbb92
  • 61
  • 4
  • That line of code is actually there except the last '-' was missing in each line of code so in added the '-' in all the lines and there's still error but fewer errors so your code helps but there's still some more problems. The error is -- npm ERR! code ELIFECYCLE, npm ERR! errno 1 and so on. Theres also an errror which says "This is probably not a problem with npm. There is likely addiditonal logging output above". Hope it helps to find out the problem – Sang Tonsing Sep 03 '20 at 12:04
  • I updated the screenshots of the errors kindly please check it. – Sang Tonsing Sep 03 '20 at 12:12
0

In your package.json file change the start script as:

"scripts": {
   "start": "react-scripts start -o",
   "build": "react-scripts build",
   .
   .
   .

I think it's "start": "react-scripts-start" which is causing problem for you.

DevLoverUmar
  • 11,809
  • 11
  • 68
  • 98
0

You may be missing the react-scripts module. Run npm install react-scripts --save in your project and your package.json should be the way it was initially:

"scripts":{
"start":"react-scripts start",
"build":"react-scripts build",
"test":"react-scripts test",
"eject":"react-scripts eject",
}
dbow513
  • 16
  • 4
0
nvm install 10.23.0
npm start
npm run build
Suraj Rao
  • 29,388
  • 11
  • 94
  • 103
0

Brother I think your npm version or nodejs version is outdated You’ll need to have Nodejs >= 14.0.0 and npm >= 5.6 on your machine. Or use windows 8.1 , 10 . Not the windows 7

0

Simple delete the node_modules folder and run npm install in the appname directory. Let me know if it don't help.

Sahil Rajpal
  • 510
  • 4
  • 8
0
  1. delete node_modules
  2. run npm install
  3. after that run npm start

if above does't work

  1. delete node_modules
  2. delete package-lock.json
  3. run npm install
  4. and then npm start

if above solutions does not fixed your problem, try the following this worked for me:

if you want to start on another port or PORT command not found error then do the following steps:

  1. open package.json file
  2. inside script replace the start command with below "start": "set PORT=3006 && react-scripts start"
Manji
  • 31
  • 5