[javascript] Start script missing error when running npm start

I'm receiving this error when trying to debug my node application using the npm start command.

Error:
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3

npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\andrmoll.NORTHAMERICA\Documents\GitHub\SVIChallenge\npm-debug.log
From the debug file:
Error: missing script: start
       at run (C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:142:19)
       at C:\Program Files\nodejs\node_modules\npm\lib\run-script.js:58:5
       at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:345:5
       at checkBinReferences_ (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:309:45)
       at final (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:343:3)
       at then (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:113:5)
       at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:300:12
       at evalmachine.<anonymous>:334:14
       at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:102:5
       at FSReqWrap.oncomplete (evalmachine.<anonymous>:95:15)

This question is related to javascript node.js express package.json npm-scripts

The answer is


Installing create-react-app globally is now discouraged. Instead uninstall globally installed create-react-app package by doing: npm uninstall -g create-react-app (you may have to 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.

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


"scripts": {
  "prestart": "npm install",
  "start": "http-server -a localhost -p 8000 -c-1"
}

add this code snippet in your package.json, depending on your own configuration.


I had this issue while installing react-js for the first time : These line helped me solve the issue:

npm rm -g create-react-app
npm install -g create-react-app
npx create-react-app my-app

source: https://stackoverflow.com/a/59260128/11652661


As per the react documentation https://create-react-app.dev/docs/getting-started/ The following commands will resolve the issue.

npx create-react-app my-app cd my-app npm start


This error also happens if you added a second "script" key in the package.json file. If you just leave one "script" key in the package.json the error disappears.


In my case, if it's a react project, you can try to upgrade npm, and then upgrade react-cli

npm -g install npm@version
npm install -g create-react-app

Please use the below line of code in script object which is there in package.json

"scripts": {
    "start": "webpack-dev-server --hot"
}

For me it worked perfectly fine.


I have solved mine. Its not an NPM Error its related to proxy behavior.

If you are behind proxy,

MAC
 1.  Goto System Preference (gears icon on your mac)
 2.  click your network
 3.  click advanced
 4.  click proxy
 5.  check excludes simple hostnames
 6.  add this line below (Bypass Proxy Settings...) "localhost, localhost:8080"

refer to the npm echo: "Project is running at http://localhost:8080/"

Windows
 1.  Goto your browser Proxy Settings (google it)
 2.  check Bypass local address
 3.  add this line below "localhost, localhost:8080"

In my case, it wasn't working because I used "scripts" twice. After combining - it is ok.

"scripts": {
  "test": "make test",
  "start": "node index.js"
}

I got this error because I wasn't in the right directory in terminal.

App with the scripts was in folder B. Folder B was in folder A. I open folder A in vscode and enter "npm run start" into the built in terminal and got the error. try "cd folder B", opening folder B in the ide, or organizing your stuff better than I did in the first place.


I have the same issue. I try to write a code in package.json file as below

    "scripts": {
    "start": "<your-script-file>.js",
    "test": "echo \"Error: no test specified\" && exit 1"
  },

You might have an old (global) installation of npm which causes the issue. As of 12/19, npm does not support global installations.

First, uninstall the package using:
npm uninstall -g create-react-app

Some osx/Linux users may need to also remove the old npm using:
rm -rf /usr/local/bin/create-react-app

This is now the only supported method for generating a project:
npx create-react-app my-app

Finally you can run:
npm start


Take a look at your client/package.json. You have to have these scripts

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

Make sure the PORTS ARE ON

var app = express();
app.set('port', (process.env.PORT || 5000));

BLAL BLA BLA AND AT THE END YOU HAVE THIS

app.listen(app.get('port'), function() {
    console.log("Node app is running at localhost:" + app.get('port'))
});

Still a newbee in node js but this caused more of this.


I am getting this error with a ruby on rails app, I don't know what script name to put in my package.json file. I tried:

"scripts": {
      "start": "webpack-dev-server --hot"
  }

But I got this error:

remote: App container failed to start!!
=====> taaalk web container output:
       > [email protected] start
       > webpack-dev-server --hot
       /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /app/bin/webpack-dev-server:10:in `<main>'
       npm ERR! code 1
       npm ERR! path /app
       npm ERR! command failed
       npm ERR! command sh -c webpack-dev-server --hot
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2020-11-27T01_01_54_386Z-debug.log
       > [email protected] start
       > webpack-dev-server --hot
       /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /app/bin/webpack-dev-server:10:in `<main>'
       npm ERR! code 1
       npm ERR! path /app
       npm ERR! command failed
       npm ERR! command sh -c webpack-dev-server --hot
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2020-11-27T01_01_55_590Z-debug.log
       > [email protected] start
       > webpack-dev-server --hot
       /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /app/bin/webpack-dev-server:10:in `<main>'
       npm ERR! code 1
       npm ERR! path /app
       npm ERR! command failed
       npm ERR! command sh -c webpack-dev-server --hot
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2020-11-27T01_01_56_835Z-debug.log
       > [email protected] start
       > webpack-dev-server --hot
       /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /app/bin/webpack-dev-server:10:in `<main>'
       npm ERR! code 1
       npm ERR! path /app
       npm ERR! command failed
       npm ERR! command sh -c webpack-dev-server --hot
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2020-11-27T01_01_58_249Z-debug.log
       > [email protected] start
       > webpack-dev-server --hot
       /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /app/bin/webpack-dev-server:10:in `<main>'
       npm ERR! code 1
       npm ERR! path /app
       npm ERR! command failed
       npm ERR! command sh -c webpack-dev-server --hot
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2020-11-27T01_02_00_063Z-debug.log
       > [email protected] start
       > webpack-dev-server --hot
       /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require': cannot load such file -- bundler/setup (LoadError)
        from /usr/lib/ruby/2.5.0/rubygems/core_ext/kernel_require.rb:59:in `require'
        from /app/bin/webpack-dev-server:10:in `<main>'
       npm ERR! code 1
       npm ERR! path /app
       npm ERR! command failed
       npm ERR! command sh -c webpack-dev-server --hot
       npm ERR! A complete log of this run can be found in:
       npm ERR!     /app/.npm/_logs/2020-11-27T01_02_02_705Z-debug.log
=====> end taaalk web container output
To taaalk.co:taaalk
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '[email protected]:taaalk'

I am not very familiar with these sorts of problems so am a bit lost!


Another possible reason: you're using npm when your project is initialized in yarn. (I did this myself). So it would be yarn start instead of npm start.


check package.json file having "scripts" property is there or not. if not update script property like this

{
  "name": "csvjson",
  "version": "1.0.0",
  "description": "upload csv to json and insert it into MongoDB for a single colletion",
  "scripts": {
    "start": "node csvjson.js"
  },
  "dependencies": {
    "csvjson": "^4.3.4",
    "fs": "^0.0.1-security",
    "mongodb": "^2.2.31"
  },
  "devDependencies": {},
  "repository": {
    "type": "git",
    "url": "git+https://github.com/giturl.git"
  },
  "keywords": [
    "csv",
    "json",
    "mongodb",
    "nodejs",
    "collection",
    "import",
    "export"
  ],
  "author": "karthikeyan.a",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/homepage/issues"
  },
  "homepage": "https://github.com/homepage#readme"
}

Try with these steps :

npm rm -g create-react-app

npm install -g create-react-app

npx create-react-app my-app

Definitely this works!!


If you are using babelify and watchify, go to:

package.json

and add this in "scripts":

"scripts": {
    "start": "watchify the-path-to-your-source-jsx-file -v -t [ babelify --presets [ react ] ] -o the-path-to-your-output-js-file"
}

An example would be:

"scripts": {
    "start": "watchify src/main.jsx -v -t [ babelify --presets [ react ] ] -o public/js/main.js"
}

Thanks to Mark Price from DevSlopes


I just stumbled upon this issue. I reinstalled NPM, created a new React app (so basically a clean install) and still no luck. Finally figured it out:

My terminal was NOT in the correct location.

I had to changedirectory one level deeper into my app. So my terminal was in my 'projects' folder instead of my 'my-app' folder

Path: '/Documents/projects/my-app'


should avoid using unstable npm version.

I observed one thing that is npm version based issue, npm version 4.6.1 is the stable one but 5.x is unstable because package.json will be configured perfectly while creating with default template if it's a stable version and so we manually don't need to add that scripts.

I got the below issue on the npm 5 so I downgraded to npm 4.6.1 then its worked for me,


ERROR: npm 5 is not supported yet


It looks like you're using npm 5 which was recently released.

Create React Native App doesn't work with npm 5 yet, unfortunately. We recommend using npm 4 or yarn until some bugs are resolved.

You can follow the known issues with npm 5 at: https://github.com/npm/npm/issues/16991


Devas-MacBook-Air:SampleTestApp deva$ npm start npm ERR! missing script: start


Examples related to javascript

need to add a class to an element How to make a variable accessible outside a function? Hide Signs that Meteor.js was Used How to create a showdown.js markdown extension Please help me convert this script to a simple image slider Highlight Anchor Links when user manually scrolls? Summing radio input values How to execute an action before close metro app WinJS javascript, for loop defines a dynamic variable name Getting all files in directory with ajax

Examples related to node.js

Hide Signs that Meteor.js was Used Querying date field in MongoDB with Mongoose SyntaxError: Cannot use import statement outside a module Server Discovery And Monitoring engine is deprecated How to fix ReferenceError: primordials is not defined in node UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.62.dylib error running php after installing node with brew on Mac internal/modules/cjs/loader.js:582 throw err DeprecationWarning: Buffer() is deprecated due to security and usability issues when I move my script to another server Please run `npm cache clean`

Examples related to express

UnhandledPromiseRejectionWarning: This error originated either by throwing inside of an async function without a catch block jwt check if token expired Avoid "current URL string parser is deprecated" warning by setting useNewUrlParser to true MongoNetworkError: failed to connect to server [localhost:27017] on first connect [MongoNetworkError: connect ECONNREFUSED 127.0.0.1:27017] npm notice created a lockfile as package-lock.json. You should commit this file Make Axios send cookies in its requests automatically What does body-parser do with express? SyntaxError: Unexpected token function - Async Await Nodejs Route.get() requires callback functions but got a "object Undefined" How to redirect to another page in node.js

Examples related to package.json

SyntaxError: Cannot use import statement outside a module Module not found: Error: Can't resolve 'core-js/es6' Can not find module “@angular-devkit/build-angular” Error: EPERM: operation not permitted, unlink 'D:\Sources\**\node_modules\fsevents\node_modules\abbrev\package.json' Field 'browser' doesn't contain a valid alias configuration How do I add a custom script to my package.json file that runs a javascript file? "unexpected token import" in Nodejs5 and babel? Start script missing error when running npm start How to use private Github repo as npm dependency How to set environment variables from within package.json?

Examples related to npm-scripts

Start script missing error when running npm start How to set environment variables from within package.json?