"scripts": {
"start": "npm run prod",
"build": "npm-run-all clean transpile",
"server": "node ./dist/bin/www",
"dev": "npm run lint && NODE_ENV=development nodemon --inspect=notifications:9236 --exec babel-node bin/www",
"prod": "NODE_ENV=production npm-run-all build server",
"transpile": "babel ./ --out-dir dist",
"lint": "eslint '*.js' ",
"lint:watch": "watch 'npm run lint' ",
"precommit": "npm run lint",
"prepush": "npm run lint",
"clean": "rimraf dist",
"test": "jest"
}
I have multiple microservices on docker, each one contains similar scripts in their package.json.
Whenever I make a change and save the file, nodemon does not detect the change & restart the server.
Nodemon does start when a microservice is booted up, outputting the following:
[nodemon] 2.0.15
[nodemon] to restart at any time, enter `rs`
[nodemon] watching path(s): **/* public/**/*
[nodemon] watching extensions: js,mjs,json
[nodemon] starting `babel-node --inspect=notifications:9236 bin/www`
I have to mention, this is a project built on Mac OS and I am currently running it on Windows, if it is any relevant.
4
Answers
In whatever start script you are trying to run, you need to include
nodemon
ex:
Maybe it’s already the case, but do you have your code folder as a volume ? Because if you don’t use a volume to share your local changes with the dockerized files, it won’t update because the files will stay the same
It’s relevant on windows, because the file system difference in containers that run unix Duplicate question
if you setup
nodemon.json
to poll changes it should update, but it is very expensive memory wiseI’m watching files via nodemon
--watch '**/*'
this will finds any changes in the nested files