nodemon -v: 1.18.8node -v: 9.4.0inspector restart on file change
Starting inspector on 0.0.0.0:9229 failed: address already in use
using a dockerfile like :
FROM node:slim
# Create app directory
WORKDIR /usr/app
# Install app dependencies
COPY package.json /usr/app/
RUN npm install
# Bundle app source
COPY . /usr/app
CMD [ "npm", "run", "watch" ]
Is the watch scripts entry the same as ./node_modules/.bin/nodemon --inspect=0.0.0.0 --legacy-watch ./src ./src/index.js?
And can you replicate with this script:
require('http').createServer((req, res) => res.end('ok')).listen(8000);
Is the
watchscripts entry the same as./node_modules/.bin/nodemon --inspect=0.0.0.0 --legacy-watch ./src ./src/index.js?And can you replicate with this script:
require('http').createServer((req, res) => res.end('ok')).listen(8000);
yes, this is the watch entry
and yes i replicate the problem with index.js containing only this line of code
here is my package.json if needed
{
"name": "",
"version": "1.4.1",
"main": "index.js",
"scripts": {
"start": "node ./src/index.js",
"watch": "./node_modules/.bin/nodemon --inspect --watch ./src ./src/index.js",
"test": "echo 'no test implemented !!'"
},
"license": "MIT",
"dependencies": {
"axios": "^0.18.0",
"body-parser": "^1.18.3",
"dotenv": "^6.0.0",
"express": "^4.16.3",
"foreman": "^3.0.1",
"jsonwebtoken": "^8.3.0",
"mongodb": "^2.2.14",
"mssql": "^4.1.0",
"nodemon": "^1.18.8"
}
}
docker-compose : 1.22.0
docker : 18.09.0
Can you provide a full working Dockerfile and docker-compose.yml file? I know _very little_ about docker, so it's hard for me to replicate fully to debug. (and possibly how to start the container…)
you will find a project setup to reproduce the issue here : https://github.com/xDelph/nodemon-issue-inspector
just launch docker-compose up at the root
Sorry - I've _just_ solved the issue (with a lot of messing on the command line).
If you do a hard upgrade of nodemon, it should include the latest pstree.[email protected] (a quick check with npm ls pstree.remy should validate). If you have that sub-dep, then you'll find it properly kills the inspector.
Step 6/9 : RUN npm ls pstree.remy
---> Running in 97c4d86b2c37
/usr/app
`-- [email protected]
`-- [email protected]
the version of pstree.remy seems ok now in my docker
but now i get :
/usr/app/node_modules/pstree.remy/lib/index.js:25
webapi_1 | .catch(error => callback(error));
webapi_1 | ^
webapi_1 |
webapi_1 | SyntaxError: missing ) after argument list
webapi_1 | at new Script (vm.js:83:7)
webapi_1 | at createScript (vm.js:267:10)
webapi_1 | at Object.runInThisContext (vm.js:319:10)
webapi_1 | at Module._compile (internal/modules/cjs/loader.js:686:28)
webapi_1 | at Object.Module._extensions..js (internal/modules/cjs/loader.js:734:10)
webapi_1 | at Module.load (internal/modules/cjs/loader.js:620:32)
webapi_1 | at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
webapi_1 | at Function.Module._load (internal/modules/cjs/loader.js:552:3)
webapi_1 | at Module.require (internal/modules/cjs/loader.js:659:17)
webapi_1 | at require (internal/modules/cjs/helpers.js:22:18)
which is very weird
Yeah, my bad for being a plum. Re-install and .6 is good 😢
great, it's ok now
thanks for your help ;)
As described in #1476 I'm still seeing this issue with 1.18.9.
The issue is intermittent with the following start command:
./node_modules/.bin/nodemon --inspect=0.0.0.0:9229 ./index.js
I get this issue all the time. Not sure when exactly it started happening, but it didn't use to happen.
node v11.11.0 via alpine-v11
─┬ [email protected]
└── [email protected]
"dev": "nodemon -L -d 2 --inspect=0.0.0.0:9229 -- --icu-data-dir=$NODE_ICU_DATA_PATH index.js"
Would be happy to retrieve any logs or additional info to help narrow this down.
I get this issue all the time. Not sure when exactly it started happening, but it didn't use to happen.
node v11.11.0 via alpine-v11
─┬ [email protected] └── [email protected]
"dev": "nodemon -L -d 2 --inspect=0.0.0.0:9229 -- --icu-data-dir=$NODE_ICU_DATA_PATH index.js"
Would be happy to retrieve any logs or additional info to help narrow this down.
@JonDum - Happens to me as well. See logs below:
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
Debugger listening on ws://127.0.0.1:9229/5c2962b0-43a0-4210-93ac-fc81e6d537f8
For help, see: https://nodejs.org/en/docs/inspector
Example app listening on port 3000!
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
Debugger listening on ws://127.0.0.1:9229/f0c7fdda-8b0f-4ebe-8a79-37099d8596d6
For help, see: https://nodejs.org/en/docs/inspector
Example app listening on port 3000!
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
Debugger listening on ws://127.0.0.1:9229/3336a7df-a763-440e-9e92-20ec0811726b
For help, see: https://nodejs.org/en/docs/inspector
Example app listening on port 3000!
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
[nodemon] restarting due to changes...
Debugger listening on ws://127.0.0.1:9229/cc164e40-316f-4b07-8bc2-c2dc80f5d515
For help, see: https://nodejs.org/en/docs/inspector
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
Debugger listening on ws://127.0.0.1:9229/86884f82-93b2-4885-a580-3f29b00f1065
For help, see: https://nodejs.org/en/docs/inspector
Example app listening on port 3000!
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
[nodemon] app crashed - waiting for file changes before starting...
Starting inspector on 127.0.0.1:9229 failed: address already in use
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
[nodemon] app crashed - waiting for file changes before starting...
Starting inspector on 127.0.0.1:9229 failed: address already in use
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
[nodemon] app crashed - waiting for file changes before starting...
Starting inspector on 127.0.0.1:9229 failed: address already in use
[nodemon] restarting due to changes...
[nodemon] starting `node --inspect -r ts-node/register ./src/index.ts`
[nodemon] app crashed - waiting for file changes before starting...
Starting inspector on 127.0.0.1:9229 failed: address already in use
Happens to me as well:
nodemon@^1.18.11:
version "1.18.11"
resolved "https://registry.yarnpkg.com/nodemon/-/nodemon-1.18.11.tgz#d836ab663776e7995570b963da5bfc807e53f6b8"
integrity sha512-KdN3tm1zkarlqNo4+W9raU3ihM4H15MVMSE/f9rYDZmFgDHAfAJsomYrHhApAkuUemYjFyEeXlpCOQ2v5gtBEw==
dependencies:
chokidar "^2.1.5"
debug "^3.1.0"
ignore-by-default "^1.0.1"
minimatch "^3.0.4"
pstree.remy "^1.1.6"
semver "^5.5.0"
supports-color "^5.2.0"
touch "^3.1.0"
undefsafe "^2.0.2"
update-notifier "^2.5.0"
Not sure why it's happening. Here's my package.json script...:
"dev": "nodemon app.js --exec babel-node --inspect --"
Maybe my workaround can help you guys:
https://stackoverflow.com/questions/43898947/docker-node-app-always-crashes-on-file-change-using-nodemon/55881699#55881699
Sorry for upping this, but I'm having the exact same issue :|
It's fine in my case because it's running in docker, but that's probably not something fine
My code is wrong, so it appears.
Just add --delay 300ms into the command solved my problem.
https://github.com/remy/nodemon#delaying-restarting
Most helpful comment
As described in #1476 I'm still seeing this issue with
1.18.9.The issue is intermittent with the following start command:
./node_modules/.bin/nodemon --inspect=0.0.0.0:9229 ./index.js