Search code examples
nodemon

How to change nodemon default start file?


i have a web-application. I want to use nodemon with it. To start my application need to run 'node ./bin/www', but nodemon default run another file. And my web-applications doesn't aviable.

When i type in cmd

nodemon

i got:

[nodemon] 1.14.10
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node app.js`

but i want change default start file from node app.js to node ./bin/www

How can i do this?

package.json

{
  "name": "loc8r",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "node ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.18.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.6.9",
    "express": "~4.15.5",
    "jade": "~1.11.0",
    "mongoose": "4.13.9",
    "morgan": "~1.9.0",
    "nodemon": "^1.14.9",
    "readline": "1.3.0",
    "request": "^2.83.0",
    "serve-favicon": "~2.4.5"
  },
  "main": "app.js",
  "devDependencies": {},
  "author": "",
  "license": "ISC",
  "description": ""
}

Solution

  • nodemon should pick up what ever file is in "main": "file_to_be_executed.js", so if www is your file to be executed, change: "main": "app.js", to: "main": "./bin/www",