nodemon: upon updating to 2.0.9^ Unhandled promise rejection warning on save while running nodemon.

  • nodemon -2.0.9:
  • node -12.16.3:
  • OS : Windows 10
  • terminal: gitbash and also in vscode terminal(poweshell)
  • Not using docker
  • This happens when I run "server": "cross-env NODE_ENV=development nodemon index.js", this script.

Expected behaviour

I expect nodemon to restart and track my changes.

Actual behaviour

nodemon throws an unhandled promise rejection warning on save.

image

I updated to 2.0.9 because of the closing response on issue #1854

Now nodemon still fails to restart, but it does so with this new unhandled promise rejection.

I tried a few different methods of updating nodemon like npm install nodemon@latest and npm update nodemon. And also tried uninstalling it completely both locally and globally. Then reinstalling

I will also make a note that the unhandled promise rejection occurs on nodemon versions 2.0.8-alpha.a and up.

When I downgrade to 2.0.7 it silently fails to restart still.

image

Steps to reproduce

I’m on windows 10, My package.json looks like this

{
  "name": "new",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "server": "cross-env NODE_ENV=development nodemon index.js",
    "client": "npm run start --prefix client",
    "dev": "concurrently \"npm run server\" \"npm run client\"",
    "start": "node index.js",
    "migrate": "knex migrate:rollback && knex migrate:latest && knex seed:run",
    "heroku-postbuild": "NPM_CONFIG_PRODUCTION=false npm install --prefix client && npm run build --prefix client"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "dependencies": {
    "aws-sdk": "^2.886.0",
    "bcrypt": "^5.0.1",
    "cross-env": "^7.0.3",
    "dotenv": "^8.2.0",
    "express": "^4.17.1",
    "express-jwt": "^6.0.0",
    "express-session": "^1.17.1",
    "jsonwebtoken": "^8.5.1",
    "knex": "^0.95.4",
    "knexnest": "^1.0.0",
    "moment": "^2.29.1",
    "moment-timezone": "^0.5.33",
    "mongoose": "^5.12.2",
    "morgan": "^1.10.0",
    "multer": "^1.4.2",
    "passport": "^0.4.1",
    "passport-facebook": "^3.0.0",
    "passport-google-oauth20": "^2.0.0",
    "passport-jwt": "^4.0.0",
    "passport-linkedin-oauth2": "^2.0.0",
    "passport-local": "^1.0.0",
    "path": "^0.12.7",
    "pg": "^8.6.0",
    "react-icons": "^4.2.0",
    "stripe": "^8.140.0",
    "universal-cookie": "^4.0.4",
    "uuid": "^8.3.2"
  },
  "devDependencies": {
    "concurrently": "^6.0.0",
    "nodemon": "^2.0.9"
  }
}



results from --dump

--------------
node: v12.16.3
nodemon: 2.0.7
command: C:\Program Files\nodejs\node.exe C:\Users\unomi\OneDrive\Desktop\workwip_deployed\web-workwip\node_modules\nodemon\bin\nodemon.js --dump index.js
cwd: C:\Users\unomi\OneDrive\Desktop\workwip_deployed\web-workwip
OS: win32 x64
--------------
{
  run: false,
  system: {
    cwd: 'C:\\Users\\unomi\\OneDrive\\Desktop\\workwip_deployed\\web-workwip'
  },
  required: false,
  dirs: [
    'C:\\Users\\unomi\\OneDrive\\Desktop\\workwip_deployed\\web-workwip'
  ],
  timeout: 1000,
  options: {
    dump: true,
    ignore: [
      '**/.git/**',
      '**/.nyc_output/**',
      '**/.sass-cache/**',
      '**/bower_components/**',
      '**/coverage/**',
      '**/node_modules/**',
      re: /.*.*\/\.git\/.*.*|.*.*\/\.nyc_output\/.*.*|.*.*\/\.sass\-cache\/.*.*|.*.*\/bower_components\/.*.*|.*.*\/coverage\/.*.*|.*.*\/node_modules\/.*.*/
    ],
    watch: [ '*.*', re: /.*\..*/ ],
    monitor: [
      '*.*',
      '!**/.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: 'index.js',
      exec: 'node',
      args: [],
      scriptPosition: 0,
      nodeArgs: undefined,
      execArgs: [],
      ext: 'js,mjs,json',
      env: {}
    }
  },
  load: [Function],
  reset: [Function: reset],
  lastStarted: 0,
  loaded: [],
  watchInterval: null,
  signal: 'SIGUSR2',
  command: {
    raw: { executable: 'node', args: [ 'index.js' ] },
    string: 'node index.js'
  }
}
--------------

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 4
  • Comments: 64 (15 by maintainers)

Most upvoted comments

I solved this problem by uninstalling nodemon version 2.0.12 and then installing 2.0.7

I managed to replicate it by disabling Windows Management Instrumentation service. docs. its a windows problem

Can you install npm i -g nodemon@debug and try with this version and let me know the outcome?

I tried this but the error is still there. Now, I have installed 2.0.7 version and its working fine for me.

I still get the same error after doing everything said above…

I believe I’ve tried everything to try and get Nodemon working on my W10 system but so far have failed. I’ve switched to Supervisor and it works a treat for me. But I’d like to get Nodemon working so will be keeping an eye on developments.

finish checking environment variables from Windows 10; apparently everything is fine but the error in nodemon persists; I don’t know if you could tell me where exactly you modify the environment variables. Thanks

Right click on This PC > properties > advanced settings > environment variables > Choose path in system. Make sure you have system32 path included. This has solved my issue while I was working on a windows 7 pc some days before. But I have upgraded to win 10 recently, certainly there are no issues too. So I’m quite sure this has to do something with windows.

looks like everyone is having this issue, I will wait for an update then

NO, the problem is not linked with nodemon. It is linked with windows. Please make sure you have the system32 path specified in the system environment variable.

I have the same problem of an unhandled exception when I save on Windows 10, nodemon 2.0.9, node 14.16.1.

(node:13604) UnhandledPromiseRejectionWarning: Error: Command failed: wmic process where (ParentProcessId=13880) get ProcessId 2> nul

finish checking environment variables from Windows 10; apparently everything is fine but the error in nodemon persists; I don’t know if you could tell me where exactly you modify the environment variables. Thanks

Right click on This PC > properties > advanced settings > environment variables > Choose path in system. Make sure you have system32 path included. This has solved my issue while I was working on a windows 7 pc some days before. But I have upgraded to win 10 recently, certainly there are no issues too. So I’m quite sure this has to do something with windows.

Can send a print of who u config environment variables? I tried to add system32 to env in several different ways and nodemon didn’t work again

@DineshRout779 I’m pushing nodemon@2.0.11 to address this last issue you hit.

And closing the main issue now 👍

Finally, I found this is another issue encountered a year before. I just added the system32 folder to my system path and it worked like before. By the way, thanks, man! and sorry for the trouble, I caused unnecessarily.

I’m having trouble replicating.

This is my environment:

  • node@14
  • nodemon@debug (I’ve just pushed a new tweak) - 2.0.10-alpha.2
  • Windows 10 home, version 20H2
  • Tested both command prompt and powershell

Screenshots included:

Screenshot 2021-07-07 at 11 52 02 Screenshot 2021-07-07 at 11 48 32 Screenshot 2021-07-07 at 11 48 13

@remy no, sorry if that was unclear. It doesn’t restart nodemon on save, unless there is a compiling error, then it will actually restart with the changes. Otherwise it will throw this error and not restart with changes. I edited my comment above but ill mention it here too, the promise rejection warning begins to happen on 2.0.8-alpha.a and higher. I also checked versions from 2.0.7 to 1.19.4 and nodemon fails to restart on save on those versions as well but with no error.