6

how to run npm start

Bhanukas-MacBook-Pro:Shopping Card Admin Panel bhanukaisuru$ npm start npm ERR! missing script: start

npm ERR! A complete log of this run can be found in: npm ERR!
/Users/bhanukaisuru/.npm/_logs/2019-05-01T05_42_52_916Z-debug.log

package.json file

{
  "name": "shopping-cart-admin-panel",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "axios": "^0.18.0",
    "bootstrap": "^4.3.1",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-router-dom": "^5.0.0",
    "react-scripts": "3.0.0"
  },
  "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"
    ]
  },
  "proxy": "http://localhost:3000"
}

8 Answers8

7

I can see you do have "start" script in your package.json

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

react-scripts is a set of scripts from the create-react-app starter pack.

You need to run npm start command in your terminal in order to run the app.

In common apps, the start script looks like so:

"start": "npx node index.js"

Where index.js can be also the server.js file

Tomer
  • 1,521
  • 1
  • 15
  • 26
4

it is because of global installation of create-react-app or your node.js is not updated.follow the below steps

  1. uninstall react from global

    ----> npm uninstall -g create-react-app

  2. Then try to update the npm and all the packages.

    ----> npm install -g npm@latest

  3. Now create your new react app

    ----> npx create-react-app yout-app-name

0

I had this same problem at an early stage. Getting the error:

npm ERR! missing script: start

For starters, make sure that you are in the "client" (cd client) or whichever name that you chose to build your creat-react-app 's client side.

It seems as if you already have your start and react-scripts, so hope this helps.

Tray Fleary
  • 421
  • 1
  • 4
  • 9
0

I had the same issue and spent a whole day trying to fix it, only to realize that the root folder in which I created the react app had a "&" sign in it. npm has looked up the start script on an invalid folder path by omitting the characters before and including the &. Once I moved the project to a no-nonsense folder path, everything worked flawlessly. Hope this helps out a Node/React newbie like me.

noobmaster007
  • 153
  • 2
  • 11
0

Suggestions --> -sometimes , if you install yarn specifically using $ npm install -g yarn., this blocks all sort of scripts and react dom to install and it creates yarn.lock file which blocks it creating the scripts . So uninstall yarn using

$ npm uninstall -g yarn

and then delete all specific folders that were created previously on the project. And run
$npx create-react-app my-app Happy Hacking!

Markus
  • 2,265
  • 5
  • 28
  • 54
romzi
  • 1
0
ERR: Script missing

For a solution follow these steps in PowerShell

  1. uninstall react from global
 npm uninstall -g create-react-app
  2. Then try to update the npm and all the packages.
npm install -g npm@latest
  3. Now create your new react app
npx create-react-app yout-app-name
Julian Kleine
  • 1,539
  • 6
  • 14
ihsan
  • 1
0

consider you checked any app from git open your package.json

under the scripts section, you will have the field called start

for the create react app,this will be like "start": "npx node index.js

But for your app, you may have customized scripts something like

"start:env": "some env configs"

just try to run cmd in your terminal npm run start:env

0

Dear Guys in most of our cases everything is Ok! The most common that we do in fact, is that we start the same path in our code editor that we have already choosen for already existing folders. So while working with react make sure that you have open the right folder with right path in you code editor and then simply! ----npm start"-- It would almost in all cases if you take this little caution, Otherwise all your codes will be useless if apply this on wrong path or folder.