1

Trying to streamline my package.json and local development with a custom script to run Nodemon. I'm currently building an app with a front and back end I need to call mongod before start and before my custom in two tabs however I'm running into an issue.

mongod will only run in the terminal if the terminal path is set to local from testing and I've read:

I can use prestart as:

"scripts": {
    "prestart": "cd && mongod",
    "start": "node app",
    "nodemon": "./node_modules/.bin/nodemon app"
}

but I'm not seeing how I should chain a prestart with a custom scripts. When I try to chain it with nodemon as:

"scripts": {
    "prestart": "cd && mongod",
    "start": "node app",
    "nodemon": "cd && mongod && ./node_modules/.bin/nodemon app"
},

Nodemon is fired first than mongodb crashes in my package.json when I call Nodemon as:

npm run nodemon

How can I start mongod before starting nodemon in my development process through one command in the package.json?

DᴀʀᴛʜVᴀᴅᴇʀ
  • 7,681
  • 17
  • 73
  • 127

0 Answers0