Jumar Juaton
Jumar Juaton

Reputation: 113

How to fix npm ERR! missing script: start in react

When I run npm start, I get an error:

npm ERR! missing script: start in react

I've tried this but didn't work: https://techoverflow.net/2019/04/01/how-to-fix-npm-err-missing-script-start/

My package.json:

{
    "private": true,
    "scripts": {
        "dev": "npm run development",
        "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
        "watch-poll": "npm run watch -- --watch-poll",
        "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
        "prod": "npm run production",
        "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
    },
    "devDependencies": {
        "axios": "^0.17.1",
        "babel-plugin-syntax-dynamic-import": "^6.18.0",
        "babel-plugin-transform-class-properties": "^6.24.1",
        "babel-preset-react": "^6.23.0",
        "bootstrap-sass": "^3.3.7",
        "cross-env": "^5.2.0",
        "jquery": "^3.2",
        "laravel-mix": "^1.0",
        "lodash": "^4.17.11",
        "react": "^16.5.1",
        "react-dom": "^16.4.0"
    },
    "dependencies": {
        "antd": "^3.12.4",
        "babel-plugin-import": "^1.8.0",
        "css-loader": "^2.1.0",
        "less": "^3.9.0",
        "less-loader": "^4.1.0",
        "moment": "^2.22.2",
        "moment-timezone": "^0.5.21",
        "react-addons-update": "^15.6.2",
        "react-redux": "^5.0.7",
        "react-responsive-modal": "^4.0.1",
        "react-router-dom": "^4.3.1",
        "redux": "^4.0.0",
        "redux-thunk": "^2.3.0",
        "style-loader": "^0.23.1"
    }
}

What am I missing?

Upvotes: 0

Views: 3167

Answers (2)

Goku
Goku

Reputation: 4330

I tried deleting, and reinstalling everything from the beginning in the future, to be, project folder and ran the latest react install and it worked for me.

try again: npm i -g create-react-app (without version number and in the folder where you plan to do work)

tips: don't over complicate debugging sometimes out of fear, and sometimes try different versions of software despite tutorial dictation.

  • Good Luck!

Actually, this YouTube video @ 3:30 mins offers a SIMILAR solution for potential guidance! - bc the errors aren't EXACTLY identical.

https://youtu.be/T2MhVxJxsL0?t=209

Upvotes: 1

Artur Dwojak
Artur Dwojak

Reputation: 11

You're missing script called 'start' in Your package.json. Look at scripts/start line and add same (but modified for your file) in yours package.json

{
"private": true,
"scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "start": "node index.js"
},
"devDependencies": {
    "axios": "^0.17.1",
    "babel-plugin-syntax-dynamic-import": "^6.18.0",
    "babel-plugin-transform-class-properties": "^6.24.1",
    "babel-preset-react": "^6.23.0",
    "bootstrap-sass": "^3.3.7",
    "cross-env": "^5.2.0",
    "jquery": "^3.2",
    "laravel-mix": "^1.0",
    "lodash": "^4.17.11",
    "react": "^16.5.1",
    "react-dom": "^16.4.0"
},
"dependencies": {
    "antd": "^3.12.4",
    "babel-plugin-import": "^1.8.0",
    "css-loader": "^2.1.0",
    "less": "^3.9.0",
    "less-loader": "^4.1.0",
    "moment": "^2.22.2",
    "moment-timezone": "^0.5.21",
    "react-addons-update": "^15.6.2",
    "react-redux": "^5.0.7",
    "react-responsive-modal": "^4.0.1",
    "react-router-dom": "^4.3.1",
    "redux": "^4.0.0",
    "redux-thunk": "^2.3.0",
    "style-loader": "^0.23.1"
}

}

Upvotes: 1

Related Questions