Esther Ndung'u
Esther Ndung'u

Reputation: 55

npm start not running when using create-react-app

i have looked all over the internet and cant find a way to fix my problem. The following is the commands i did

C:\Users\Angengos>create-react-app learn-react

Creating a new React app in C:\Users\Angengos\learn-react.

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...


> [email protected] postinstall C:\Users\Angengos\learn-react\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall C:\Users\Angengos\learn-react\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall C:\Users\Angengos\learn-react\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> [email protected] postinstall C:\Users\Angengos\learn-react\node_modules\ajv
> opencollective-postinstall || true

+ [email protected]
+ [email protected]
+ [email protected]
added 1606 packages from 751 contributors and audited 931219 packages in 904.669s

58 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities


A template was not provided. This is likely because you're using an outdated version of create-react-app.
Please note that global installs of create-react-app are no longer supported.

C:\Users\Angengos>cd learn-react/

C:\Users\Angengos\learn-react>npm start
npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Angengos\AppData\Roaming\npm-cache\_logs\2020-04-19T17_42_57_484Z-debug.log

C:\Users\Angengos\learn-react>

AND THIS IS THE PACKAGE.json

{
  "name": "learn-react",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "react": "^16.13.1",
    "react-dom": "^16.13.1",
    "react-scripts": "3.4.1"
  }
}

AND HERE IS THE NODE AND NPM VERSION

C:\Users\Angengos\learn-react>node --version v12.16.2

C:\Users\Angengos\learn-react>npm --version 6.14.4

Upvotes: 0

Views: 1974

Answers (1)

Carlos Saiz Orteu
Carlos Saiz Orteu

Reputation: 1805

Seems the scripts are not in you package json. Add this and yry again:

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

It should look like this:

{
  "name": "learn-react",
  "version": "0.1.0",
  "private": true,
  "scripts": {
      "start": "react-scripts start",
      "build": "react-scripts build",
      "test": "react-scripts test",
      "eject": "react-scripts eject"
},
  "dependencies": {
     "react": "^16.13.1",
    "react-dom": "^16.13.1",
   "react-scripts": "3.4.1"
  }
}

Upvotes: 1

Related Questions