How to use Nodemon with a custom node.js version

How to use a specific version of Node.js (using NVM) inside of Nodemon, so your application auto-reloads after code changes, but overrides the default node version.

1. Get Nodemon and NVM; then run the NVM command to install the version of node you need for your project.

2. Create an .nvmrc file in your project root, with the version you require as the contents of that file.

3. Create a nodemon.json file in your project root with:

{
  "execMap": {
  "js": "source $HOME/.nvm/nvm.sh; nvm run"
  }
}

4. Add the following nodemon snippet in package.json as the start script:

"scripts": {
  "start": "nodemon index.js"
}