remy

remy

JavaScript (node + client side) developer with over 20 years experience. Contact me for any work or questions about JS I might be able to help you with.

Member Since 13 years ago

Left Logic / @leftlogic , Brighton, UK

Experience Points
7k
follower
Lessons Completed
6
follow
Lessons Completed
845
stars
Best Reply Awards
315
repos

2801 contributions in the last year

Pinned
⚡ Monitor for any changes in your node.js application and automatically restart the server - perfect for development
⚡ My b:log and all its content in plain (unabashed) text
⚡ Collaborative JavaScript Debugging App
⚡ A personal JSON store as a RESTful service
⚡ Web based console - for presentations and workshops
⚡ 🤖 A slack bot for retrospectives
Activity
Oct
23
21 hours ago
Activity icon
issue

remy issue remy/nodemon

remy
remy

Nodemon error for Numeric separators : syntax error invalid or unexpected token

image

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Nodemon error for Numeric separators : syntax error invalid or unexpected token

image

remy
remy

That be a node problem. Remove nodemon and test again. Happy to reopen if I'm wrong, but I'm entirely sure that doesn't exist in nodemon.

push

remy push remy/mit-license

remy
remy

Automated creation of user cog.

commit sha: 4d46c21dc43b668d893a34a4bb28cb0e5a2f9ac0

push time in 5 hours ago
Oct
22
1 day ago
Activity icon
issue

remy issue remy/nodemon

remy
remy

EADDRINUSE in 2.0.12 version

Nodemon version 2.0.12 run nodemon after change or rs i have error: Error: listen EADDRINUSE: address already in use :::3007

`events.js:291 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE: address already in use :::3007 at Server.setupListenHandle [as _listen2] (net.js:1316:16) at listenInCluster (net.js:1364:12) at Server.listen (net.js:1450:7) at Object. (C:\Users\Nikiforov.Evgeny\Documents\projects\passport\bin\app.js:35:15) at Module._compile (internal/modules/cjs/loader.js:1256:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10) at Module.load (internal/modules/cjs/loader.js:1105:32) at Function.Module._load (internal/modules/cjs/loader.js:967:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 Emitted 'error' event on Server instance at: at emitErrorNT (net.js:1343:8) at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'EADDRINUSE', errno: -4091, syscall: 'listen', address: '::', port: 3007 } `

When i rollback to version 2.0.7 - i have no errors.

Setps to reproduce:

app.js:

import express from 'express';
const server = express();

server.use(express.urlencoded({ extended: true }));
server.use(express.json());

server.listen(3007, () => {
    console.info(
        'Listening on http://localhost\nOpen http://localhost/v1/api-docs for documentation'
    );
});

package.json:

{
  "name": "nodemontest",
  "version": "1.0.0",
  "description": "test nodemon error eaddrinuse",
  "main": "app.js",
  "license": "MIT",
  "type": "module",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.7"
  },
  "scripts": {
    "server": "node ./src/app.js",
    "watch": "nodemon"
  }
}

nodemon.json:

{ 
    "watch": ["src/*"],
    "ext": "js, json, yaml",
    "exec": "yarn server"
}
  1. yarn watch
  2. wait while server run
  3. type rs and press enter or add some comment to app.js

I have Node.js v14.7.0. Windows 10 Version 1903 (Build 18362.239) Powershell version 5.1.18362.145

The usual windows command line (cmd.exe) has the same error. It looks like it's not about the terminal.

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

EADDRINUSE in 2.0.12 version

Nodemon version 2.0.12 run nodemon after change or rs i have error: Error: listen EADDRINUSE: address already in use :::3007

`events.js:291 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE: address already in use :::3007 at Server.setupListenHandle [as _listen2] (net.js:1316:16) at listenInCluster (net.js:1364:12) at Server.listen (net.js:1450:7) at Object. (C:\Users\Nikiforov.Evgeny\Documents\projects\passport\bin\app.js:35:15) at Module._compile (internal/modules/cjs/loader.js:1256:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10) at Module.load (internal/modules/cjs/loader.js:1105:32) at Function.Module._load (internal/modules/cjs/loader.js:967:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 Emitted 'error' event on Server instance at: at emitErrorNT (net.js:1343:8) at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'EADDRINUSE', errno: -4091, syscall: 'listen', address: '::', port: 3007 } `

When i rollback to version 2.0.7 - i have no errors.

Setps to reproduce:

app.js:

import express from 'express';
const server = express();

server.use(express.urlencoded({ extended: true }));
server.use(express.json());

server.listen(3007, () => {
    console.info(
        'Listening on http://localhost\nOpen http://localhost/v1/api-docs for documentation'
    );
});

package.json:

{
  "name": "nodemontest",
  "version": "1.0.0",
  "description": "test nodemon error eaddrinuse",
  "main": "app.js",
  "license": "MIT",
  "type": "module",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.7"
  },
  "scripts": {
    "server": "node ./src/app.js",
    "watch": "nodemon"
  }
}

nodemon.json:

{ 
    "watch": ["src/*"],
    "ext": "js, json, yaml",
    "exec": "yarn server"
}
  1. yarn watch
  2. wait while server run
  3. type rs and press enter or add some comment to app.js

I have Node.js v14.7.0. Windows 10 Version 1903 (Build 18362.239) Powershell version 5.1.18362.145

The usual windows command line (cmd.exe) has the same error. It looks like it's not about the terminal.

remy
remy

Published at latest. Big thanks to @immortalmind2016

Activity icon
issue

remy issue remy/nodemon

remy
remy

Nodemon stuck at "[nodemon] restarting due to changes"

  • nodemon -v: 2.0.12
  • node -v: 14.17.6
  • Operating system/terminal environment: Laptop/VS Codeterminal
  • Using Docker? What image:
  • Command you ran:
//index.js
const express = require('express');

const app = express();

app.get('', (req, res) => {
    res.send('Hello, world!');
})

const port = 3000;
const hostName = '127.0.0.1';

app.listen(port, hostName, () => {
    console.log(`The server is listening on ${hostName}:${port}`);
})

package.json

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "nodemon",
    "start": "index.js"
  },
  "author": "Sharjeel",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.12"
  }
}
Activity icon
issue

remy issue remy/nodemon

remy
remy

Error: listen EADDRINUSE: address already in use :::3000

output.txt

  • nodemon v2.0.13:
  • node v14.17.6:
  • Operating system/terminal environment: Window 10/CMD/bash/wt
  • Using Docker? What image: not docker
  • Command you ran: nodemon nodemon -w src -e ts -x ts-node ./src/index.ts

Expected behaviour

output from terminal that the node process is restarting

Actual behaviour

Error: listen EADDRINUSE: address already in use :::3000

Steps to reproduce

  • listen to the express server on port 3000
  • nodemon -w src -e ts -x ts-node index.ts

image

Activity icon
issue

remy issue remy/nodemon

remy
remy

Nodemon not restarting: [nodemon] restarting due to changes.

Nodemon not restarting: [nodemon] restarting due to changes... i use vs code if change my code but not update my code browser and show restarting use due to change

  • nodemon -v:2.0.9
  • node -v:v16.0.0
  • Operating system/terminal environment: windows 10 vs code terminal
  • Using Docker? What image:
  • Command you ran: nodemon index.js

Expected behaviour

const http = require("http"); const PORT = 3000; const hostName = "127.0.0.1"; const server = http.createServer((req,res) => { res.end("Welco my server server test test"); }) server.listen(PORT,hostName, () => { console.log(server is running at http://${hostName}:${PORT}) })

Actual behaviour

Steps to reproduce

[nodemon] 2.0.9 [nodemon] to restart at any time, enter rs [nodemon] watching path(s): . [nodemon] watching extensions: js,mjs,json [nodemon] starting node index.js server is running at http://127.0.0.1:3000 [nodemon] restarting due to changes... [nodemon] restarting due to changes...


If applicable, please append the --dump flag on your command and include the output here ensuring to remove any sensitive/personal details or tokens.

Oct
21
2 days ago
Activity icon
issue

remy issue remy/nodemon

remy
remy

Nodemon won't kill previous process after upgrade from node v10 to v16

  • Versions: Node 16.0.0, win32 Windows 10 x64, OS 10.0.19043, Electron 11.4.10
  • nodemon -v: 2.0.13

Expected behaviour

Nodemon would kill the previous electron process and restart after changes occur

Actual behaviour

Nodemon starts a new process (sometimes multiple processes) when the changes occur. Every save does this

Steps to reproduce

Everything was working fine with node v10. This started happening after upgrading to node v16. I have tried passing --signal in the command, which doesn't work.

the script that I run is is: "electron-watch": "nodemon --watch ./electron.cjs --exec "npm run electron-start""

Any ideas why this started happening after the upgrade and how I can fix it?

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Nodemon won't kill previous process after upgrade from node v10 to v16

  • Versions: Node 16.0.0, win32 Windows 10 x64, OS 10.0.19043, Electron 11.4.10
  • nodemon -v: 2.0.13

Expected behaviour

Nodemon would kill the previous electron process and restart after changes occur

Actual behaviour

Nodemon starts a new process (sometimes multiple processes) when the changes occur. Every save does this

Steps to reproduce

Everything was working fine with node v10. This started happening after upgrading to node v16. I have tried passing --signal in the command, which doesn't work.

the script that I run is is: "electron-watch": "nodemon --watch ./electron.cjs --exec "npm run electron-start""

Any ideas why this started happening after the upgrade and how I can fix it?

remy
remy

This is live in the latest release, so we can close this then.

push

remy push remy/mit-license

remy
remy

Automated creation of user tate-reed.

commit sha: 9afb2b1a49e6385b9b86f3951427ee9b42df3e75

push time in 2 days ago
Oct
20
3 days ago
push

remy push remy/mit-license

remy
remy

Automated creation of user truelayer.

commit sha: b363bfa0ab8e7e545e5b4b22acd18b19a3daf531

push time in 3 days ago
Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Nodemon not logging fatal errors when in quiet mode

  • Versions: [email protected], [email protected]_64
  • nodemon -v: 2.0.14
  • Operating system/terminal environment: bash
  • Using Docker? What image: N/A
  • Command you ran: yarn run nodemon -q <my_script.js>

This is perhaps more of a feature request than a bug, but I recently ran into an issue where one of my services was crashing with no output - it turned out the root cause was the nodemon had run out of file watchers. In normal operation nodemon will log [nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached when that happens, but in this case I was running nodemon with -q to reserve stdout for the spawned node process, and in quiet mode nodemon silently exits instead of logging the error. Judging from this function this is intentional.

Not logging fatal errors when in quiet mode is surprising behavior to me, and caused a good bit of confusion when trying to figure out what was causing this particular problem. You may want to consider logging errors that are guaranteed to make nodemon exit, since at that point figuring out what happened seems like a higher priority than keeping stdout clean anyway.

Thanks for taking a look!

Expected behaviour

Nodemon suppresses output but logs something if it crashes

Actual behaviour

ALL Nodemon output is suppressed

remy
remy

Actually, rechecking your error statement I'm now thinking this is going via the logging but it shouldn't be - actually errors don't use the nodemon logging - so this looks like nodemon is catching the error (incorrectly).

Still, you'll need to replicate - and then we need to (somehow) get a stacktrace - but we'll cross that next.

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Nodemon does not log fatal errors when in quiet mode

  • Versions: [email protected], [email protected]_64
  • nodemon -v: 2.0.14
  • Operating system/terminal environment: bash
  • Using Docker? What image: N/A
  • Command you ran: yarn run nodemon -q <my_script.js>

This is perhaps more of a feature request than a bug, but I recently ran into an issue where one of my services was crashing with no output - it turned out the root cause was the nodemon had run out of file watchers. In normal operation nodemon will log [nodemon] Internal watch failed: ENOSPC: System limit for number of file watchers reached when that happens, but in this case I was running nodemon with -q to reserve stdout for the spawned node process, and in quiet mode nodemon silently exits instead of logging the error. Judging from this function this is intentional.

Not logging fatal errors when in quiet mode is surprising behavior to me, and caused a good bit of confusion when trying to figure out what was causing this particular problem. You may want to consider logging errors that are guaranteed to make nodemon exit, since at that point figuring out what happened seems like a higher priority than keeping stdout clean anyway.

Thanks for taking a look!

Expected behaviour

Nodemon suppresses output but logs something if it crashes

Actual behaviour

ALL Nodemon output is suppressed

remy
remy

Errors don't go via the log.debug method, so it's not that function you've linked to - something else is at play.

Can you replicate consistently? (I'd imagine watching a disproportionate amount of files would do the trick, perhaps with some other system running at the same time).

If you can, we're going to debug it from your machine because I'm sure I won't be able to replicate what you're seeing myself.

Oct
19
4 days ago
push

remy push remy/mit-license

remy
remy

Automated creation of user greg.

commit sha: de697bdc0feabc0d5ea88856578679218ed8ce5c

push time in 3 days ago
push

remy push remy/nodemon

remy
remy

fix: add windows signals SIGUSR2 & SIGUSR1 to terminate the process (#1938)

Authored-by: mohamed [email protected]

Fixes: #1903, #1915, #1936, #1937, #1882, #1893

commit sha: 61e7abd730839979c3ec099830d4af7030a6ce3f

push time in 4 days ago
Activity icon
issue

remy issue remy/nodemon

remy
remy

nodemon opens windows-kill.exe but doesn't restart process

Versions

$ npm view nodemon version
2.0.12
  • Operating system/terminal environment (powershell, gitshell, etc):
    • Powershell terminal
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1023
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1023
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
  • VSCode IDE
    • Version: 1.58.2 (system setup) Commit: c3f126316369cd610563c75b1b1725e0679adfb3 Date: 2021-07-14T22:10:15.214Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.19043

Expected behaviour

Application would restart as normal, killing process and rerunning npm start which kicks off nodemon using nodemon.json config

Actual behaviour

Application starts as normal and I see the proper output in VSCode debug console. image

Changing the src/index.ts (uncommenting the code to add the "Hello World" endpoint) and saving the file does the following:

  • Prints [nodemon] restarting due to changes... to the VSCode debug window
  • Opens the windows-kill.exe window, minimized on my toolbar
  • Nothing else and doesn't restart the application

The changes are not redeployed, and the only way to proceed is to kill the process manually. image

Steps to reproduce

I have attached this sample project here as the most basic application I could get to reproduce this issue.

Manual Steps

If you wish to do this from scratch, the steps I followed were:

  • Make empty, temporary directory
  • npm init -y
  • npm i -D typescript ts-node nodemon @types/node @hapi/hapi
  • npx tsc --init
  • Create nodemon.json
{
  "watch": ["src"],
  "ext": "ts",
  "exec": "node -r ts-node/register src/index.ts"
}
  • Update package.json start script
"scripts": {
  "start": "nodemon"
},
  • Create .vscode/launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Server",
            "type": "pwa-node",
            "outputCapture": "std",
            "request": "launch",
            "runtimeArgs": [
                "run-script",
                "start"
            ],
            "runtimeExecutable": "npm",
            "skipFiles": [
                "<node_internals>/**"
            ],
        },
    ]
}
"use strict";

const Hapi = require("@hapi/hapi");

const init = async () => {
  const server = Hapi.server({
    port: 3000,
    host: "localhost",
  });

  server.route({
      method: 'GET',
      path: '/',
      handler: (request, h) => {
          return 'Hello World!';
      }
  });

  await server.start();
  console.log("Server running on %s", server.info.uri);
};

process.on("unhandledRejection", (err) => {
  console.log(err);
  process.exit(1);
});

init();

{
  run: false,
  system: { cwd: 'c:\\OpenSesame\\tmp\\nodemon-example' },
  required: false,
  dirs: [ 'c:\\OpenSesame\\tmp\\nodemon-example\\src' ],
  timeout: 1000,
  options: {
    dump: true,
    watch: [ 'src', re: /src/ ],
    exec: 'node -r ts-node/register src/index.ts',
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    monitor: [
      'c:\\OpenSesame\\tmp\\nodemon-example\\src/**/*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: null,
      exec: 'node -r ts-node/register src/index.ts',
      args: [],
      scriptPosition: null,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'ts',
      env: {}
    }
  },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [ 'c:\\OpenSesame\\tmp\\nodemon-example\\nodemon.json' ],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'node -r ts-node/register src/index.ts', args: [] },
    string: 'node -r ts-node/register src/index.ts'
  }
}
pull request

remy pull request remy/nodemon

remy
remy

fix: add windows signals SIGUSR2 & SIGUSR1 to terminate the process

on SIGUSR2 & SIGUSR1 triggers in windows, we should invoke taskkill

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

nodemon opens windows-kill.exe but doesn't restart process

Versions

$ npm view nodemon version
2.0.12
  • Operating system/terminal environment (powershell, gitshell, etc):
    • Powershell terminal
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1023
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1023
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
  • VSCode IDE
    • Version: 1.58.2 (system setup) Commit: c3f126316369cd610563c75b1b1725e0679adfb3 Date: 2021-07-14T22:10:15.214Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.19043

Expected behaviour

Application would restart as normal, killing process and rerunning npm start which kicks off nodemon using nodemon.json config

Actual behaviour

Application starts as normal and I see the proper output in VSCode debug console. image

Changing the src/index.ts (uncommenting the code to add the "Hello World" endpoint) and saving the file does the following:

  • Prints [nodemon] restarting due to changes... to the VSCode debug window
  • Opens the windows-kill.exe window, minimized on my toolbar
  • Nothing else and doesn't restart the application

The changes are not redeployed, and the only way to proceed is to kill the process manually. image

Steps to reproduce

I have attached this sample project here as the most basic application I could get to reproduce this issue.

Manual Steps

If you wish to do this from scratch, the steps I followed were:

  • Make empty, temporary directory
  • npm init -y
  • npm i -D typescript ts-node nodemon @types/node @hapi/hapi
  • npx tsc --init
  • Create nodemon.json
{
  "watch": ["src"],
  "ext": "ts",
  "exec": "node -r ts-node/register src/index.ts"
}
  • Update package.json start script
"scripts": {
  "start": "nodemon"
},
  • Create .vscode/launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Server",
            "type": "pwa-node",
            "outputCapture": "std",
            "request": "launch",
            "runtimeArgs": [
                "run-script",
                "start"
            ],
            "runtimeExecutable": "npm",
            "skipFiles": [
                "<node_internals>/**"
            ],
        },
    ]
}
"use strict";

const Hapi = require("@hapi/hapi");

const init = async () => {
  const server = Hapi.server({
    port: 3000,
    host: "localhost",
  });

  server.route({
      method: 'GET',
      path: '/',
      handler: (request, h) => {
          return 'Hello World!';
      }
  });

  await server.start();
  console.log("Server running on %s", server.info.uri);
};

process.on("unhandledRejection", (err) => {
  console.log(err);
  process.exit(1);
});

init();

{
  run: false,
  system: { cwd: 'c:\\OpenSesame\\tmp\\nodemon-example' },
  required: false,
  dirs: [ 'c:\\OpenSesame\\tmp\\nodemon-example\\src' ],
  timeout: 1000,
  options: {
    dump: true,
    watch: [ 'src', re: /src/ ],
    exec: 'node -r ts-node/register src/index.ts',
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    monitor: [
      'c:\\OpenSesame\\tmp\\nodemon-example\\src/**/*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: null,
      exec: 'node -r ts-node/register src/index.ts',
      args: [],
      scriptPosition: null,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'ts',
      env: {}
    }
  },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [ 'c:\\OpenSesame\\tmp\\nodemon-example\\nodemon.json' ],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'node -r ts-node/register src/index.ts', args: [] },
    string: 'node -r ts-node/register src/index.ts'
  }
}
remy
remy

@xsalazar are you able to test with the debug build too - as you had the original problem?

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

nodemon opens windows-kill.exe but doesn't restart process

Versions

$ npm view nodemon version
2.0.12
  • Operating system/terminal environment (powershell, gitshell, etc):
    • Powershell terminal
$PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.19041.1023
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.19041.1023
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1
  • VSCode IDE
    • Version: 1.58.2 (system setup) Commit: c3f126316369cd610563c75b1b1725e0679adfb3 Date: 2021-07-14T22:10:15.214Z Electron: 12.0.13 Chrome: 89.0.4389.128 Node.js: 14.16.0 V8: 8.9.255.25-electron.0 OS: Windows_NT x64 10.0.19043

Expected behaviour

Application would restart as normal, killing process and rerunning npm start which kicks off nodemon using nodemon.json config

Actual behaviour

Application starts as normal and I see the proper output in VSCode debug console. image

Changing the src/index.ts (uncommenting the code to add the "Hello World" endpoint) and saving the file does the following:

  • Prints [nodemon] restarting due to changes... to the VSCode debug window
  • Opens the windows-kill.exe window, minimized on my toolbar
  • Nothing else and doesn't restart the application

The changes are not redeployed, and the only way to proceed is to kill the process manually. image

Steps to reproduce

I have attached this sample project here as the most basic application I could get to reproduce this issue.

Manual Steps

If you wish to do this from scratch, the steps I followed were:

  • Make empty, temporary directory
  • npm init -y
  • npm i -D typescript ts-node nodemon @types/node @hapi/hapi
  • npx tsc --init
  • Create nodemon.json
{
  "watch": ["src"],
  "ext": "ts",
  "exec": "node -r ts-node/register src/index.ts"
}
  • Update package.json start script
"scripts": {
  "start": "nodemon"
},
  • Create .vscode/launch.json
{
    // Use IntelliSense to learn about possible attributes.
    // Hover to view descriptions of existing attributes.
    // For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
    "version": "0.2.0",
    "configurations": [
        {
            "name": "Launch Server",
            "type": "pwa-node",
            "outputCapture": "std",
            "request": "launch",
            "runtimeArgs": [
                "run-script",
                "start"
            ],
            "runtimeExecutable": "npm",
            "skipFiles": [
                "<node_internals>/**"
            ],
        },
    ]
}
"use strict";

const Hapi = require("@hapi/hapi");

const init = async () => {
  const server = Hapi.server({
    port: 3000,
    host: "localhost",
  });

  server.route({
      method: 'GET',
      path: '/',
      handler: (request, h) => {
          return 'Hello World!';
      }
  });

  await server.start();
  console.log("Server running on %s", server.info.uri);
};

process.on("unhandledRejection", (err) => {
  console.log(err);
  process.exit(1);
});

init();

{
  run: false,
  system: { cwd: 'c:\\OpenSesame\\tmp\\nodemon-example' },
  required: false,
  dirs: [ 'c:\\OpenSesame\\tmp\\nodemon-example\\src' ],
  timeout: 1000,
  options: {
    dump: true,
    watch: [ 'src', re: /src/ ],
    exec: 'node -r ts-node/register src/index.ts',
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    monitor: [
      'c:\\OpenSesame\\tmp\\nodemon-example\\src/**/*',
      '!**/.git/**',
      '!**/.nyc_output/**',
      '!**/.sass-cache/**',
      '!**/bower_components/**',
      '!**/coverage/**',
      '!**/node_modules/**'
    ],
    ignoreRoot: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**'
    ],
    restartable: 'rs',
    colours: true,
    execMap: { py: 'python', rb: 'ruby', ts: 'ts-node' },
    stdin: true,
    runOnChangeOnly: false,
    verbose: false,
    signal: 'SIGUSR2',
    stdout: true,
    watchOptions: {},
    execOptions: {
      script: null,
      exec: 'node -r ts-node/register src/index.ts',
      args: [],
      scriptPosition: null,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'ts',
      env: {}
    }
  },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [ 'c:\\OpenSesame\\tmp\\nodemon-example\\nodemon.json' ],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'node -r ts-node/register src/index.ts', args: [] },
    string: 'node -r ts-node/register src/index.ts'
  }
}
remy
remy

@peterbe

We tried. Technically, I remote-tried asking a Windows contributor to try npm i [email protected] and then she was able to use nodemon server.mjs the same way we're doing it for "unix". As of that upgrade there was no longer a need to use nodemon --signal SIGKILL server.mjs.

Just to clarify, are you saying it's working as expected with that build?

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Terminate batch job (Y/N)?

Expected behaviour

[nodemon] restarting due to changes...
[nodemon] starting `ts-node index.ts`

Actual behaviour

[nodemon] restarting due to changes...
^CTerminate batch job (Y/N)?
[nodemon] starting `ts-node index.ts`

Steps to reproduce

  • change ts file
remy
remy

Might also be worth testing with the current debug build - to test use npm i -g [email protected]

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Terminate batch job (Y/N)?

Expected behaviour

[nodemon] restarting due to changes...
[nodemon] starting `ts-node index.ts`

Actual behaviour

[nodemon] restarting due to changes...
^CTerminate batch job (Y/N)?
[nodemon] starting `ts-node index.ts`

Steps to reproduce

  • change ts file
remy
remy

in the "actual behaviour" it looks like you manually sent a break via ctrl-c - is that the case or did that somehow inject into the output?

Activity icon
issue

remy issue comment remy/nodemon

remy
remy

EADDRINUSE in 2.0.12 version

Nodemon version 2.0.12 run nodemon after change or rs i have error: Error: listen EADDRINUSE: address already in use :::3007

`events.js:291 throw er; // Unhandled 'error' event ^

Error: listen EADDRINUSE: address already in use :::3007 at Server.setupListenHandle [as _listen2] (net.js:1316:16) at listenInCluster (net.js:1364:12) at Server.listen (net.js:1450:7) at Object. (C:\Users\Nikiforov.Evgeny\Documents\projects\passport\bin\app.js:35:15) at Module._compile (internal/modules/cjs/loader.js:1256:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:1277:10) at Module.load (internal/modules/cjs/loader.js:1105:32) at Function.Module._load (internal/modules/cjs/loader.js:967:14) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12) at internal/main/run_main_module.js:17:47 Emitted 'error' event on Server instance at: at emitErrorNT (net.js:1343:8) at processTicksAndRejections (internal/process/task_queues.js:80:21) { code: 'EADDRINUSE', errno: -4091, syscall: 'listen', address: '::', port: 3007 } `

When i rollback to version 2.0.7 - i have no errors.

Setps to reproduce:

app.js:

import express from 'express';
const server = express();

server.use(express.urlencoded({ extended: true }));
server.use(express.json());

server.listen(3007, () => {
    console.info(
        'Listening on http://localhost\nOpen http://localhost/v1/api-docs for documentation'
    );
});

package.json:

{
  "name": "nodemontest",
  "version": "1.0.0",
  "description": "test nodemon error eaddrinuse",
  "main": "app.js",
  "license": "MIT",
  "type": "module",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.7"
  },
  "scripts": {
    "server": "node ./src/app.js",
    "watch": "nodemon"
  }
}

nodemon.json:

{ 
    "watch": ["src/*"],
    "ext": "js, json, yaml",
    "exec": "yarn server"
}
  1. yarn watch
  2. wait while server run
  3. type rs and press enter or add some comment to app.js

I have Node.js v14.7.0. Windows 10 Version 1903 (Build 18362.239) Powershell version 5.1.18362.145

The usual windows command line (cmd.exe) has the same error. It looks like it's not about the terminal.

remy
remy

@DzenDyn not yet - I'll close it once the release is live (rather than a debug build) 👍

Activity icon
issue

remy issue remy/nodemon

remy
remy

Nodemon stuck at "[nodemon] restarting due to changes"

  • nodemon -v: 2.0.12
  • node -v: 14.17.6
  • Operating system/terminal environment: Laptop/VS Codeterminal
  • Using Docker? What image:
  • Command you ran:
//index.js
const express = require('express');

const app = express();

app.get('', (req, res) => {
    res.send('Hello, world!');
})

const port = 3000;
const hostName = '127.0.0.1';

app.listen(port, hostName, () => {
    console.log(`The server is listening on ${hostName}:${port}`);
})

package.json

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "nodemon",
    "start": "index.js"
  },
  "author": "Sharjeel",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.12"
  }
}
Activity icon
issue

remy issue comment remy/nodemon

remy
remy

Nodemon stuck at "[nodemon] restarting due to changes"

  • nodemon -v: 2.0.12
  • node -v: 14.17.6
  • Operating system/terminal environment: Laptop/VS Codeterminal
  • Using Docker? What image:
  • Command you ran:
//index.js
const express = require('express');

const app = express();

app.get('', (req, res) => {
    res.send('Hello, world!');
})

const port = 3000;
const hostName = '127.0.0.1';

app.listen(port, hostName, () => {
    console.log(`The server is listening on ${hostName}:${port}`);
})

package.json

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "watch": "nodemon",
    "start": "index.js"
  },
  "author": "Sharjeel",
  "license": "ISC",
  "dependencies": {
    "express": "^4.17.1"
  },
  "devDependencies": {
    "nodemon": "^2.0.12"
  }
}
remy
remy

Let's keep this open until the fix is actually live (for others with the same issue to prevent dupes).

Oct
18
5 days ago
Activity icon
issue

remy issue comment remy/nodemon

remy
remy

"[nodemon] files triggering change check" how to hide these messages?

It's a bit annoying because it's making my other logs in the console hard to read.

I have a functional nodemon.json file but I can't find any setting for it.

ie:

[nodemon] files triggering change check: public/some-file.js
[nodemon] changes after filters (before/after): 1/0
[nodemon] files triggering change check: public/other-file.js
[nodemon] changes after filters (before/after): 1/0
remy
remy

You've enabled verbose debug. It's off by default.

push

remy push remy/mit-license

remy
remy

Automated creation of user e-coders.

commit sha: 5f3d3ec69f9c07a5a66c0452894db55d6ebbaaff

push time in 5 days ago
push

remy push remy/mit-license

remy
remy

Automated creation of user aasheesh-agarwal.

commit sha: 88069cad79bc1c64a110ebe68d9df34bcbaea8e7

push time in 5 days ago
Previous