Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
sharjeelfaiq opened this issue Sep 16, 2021 · 25 comments
Closed

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

sharjeelfaiq opened this issue Sep 16, 2021 · 25 comments
Labels

Comments

@sharjeelfaiq
Copy link

sharjeelfaiq commented Sep 16, 2021

  • 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"
  }
}
@xairoo
Copy link

xairoo commented Sep 17, 2021

I have the same problem, also 2.0.12. Running Windows. Have this problems since a few weeks.

It's working about 5 times, then it stucks.
Saving the file again results in a working restart (but only about ~90% or so).

@sharjeelfaiq
Copy link
Author

I've solved the problem by not installing the latest nodemon version but the old one i.e. nodemon@2.0.7
Use
npm install nodemon@2.0.7 -g (to install it globally)
npm install nodemon@2.0.7 (to install it locally)

@mdodge-ecgrow
Copy link

I'm running into the same issue. Tried running 2.0.2 and 2.0.2(like mentioned in the other closed issue). Neither helped. Also running in verbose mode, I don't see anything suspicious.

@sharjeelfaiq
Copy link
Author

sharjeelfaiq commented Sep 21, 2021

Try running nodemon version 2.0.7. It fixed my problem.

@AbhishekVenunathan
Copy link

I recently reinstalled my OS (windows 10). I started facing the same issue after that. I'm not sure which version of nodemon I was using before reinstalling my os. I tried different versions of nodemon to see if anything works.

nodemon@2.0.7 works.

nodemon@2.0.8 shows the following error pop up when I try to restart:
Windows cannot find "PROJECTPATH\node_modules\nodemon\bin\windows-kill.exe". Make sure you typed the name correctly and then try again.

nodemon@2.0.9 and nodemon@2.0.10 shows nothing and are stuck while restarting. I stopped testing after this.

P.S: I use nodemon globally.

@immortalmind2016
Copy link
Contributor

this pr solves this issue : #1938

@remy
Copy link
Owner

remy commented Oct 18, 2021

Can people following this thread test with npm i nodemon@debug and confirm if this works or not - this is the latest change with @immortalmind2016's changes.

@insyri
Copy link

insyri commented Oct 19, 2021

I've had this issue for quite some time and I encounter this everyday, I'll be using this v of nodemon for the next 4 days and update what happens.

@remy
Copy link
Owner

remy commented Oct 19, 2021

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

@remy remy reopened this Oct 19, 2021
@remy remy added the has PR label Oct 19, 2021
@sharjeelfaiq
Copy link
Author

The issue is solved. Just use version 2.0.7 of nodemon.

@insyri
Copy link

insyri commented Oct 19, 2021

That solution drops additions for the fix; to me it makes more sense to make this a fix than to use an older version of nodemon. However, that may work for a temporary solution.

remy pushed a commit that referenced this issue Oct 19, 2021
…1938)

Authored-by: mohamed <mohamedsalah.software@gmail.com>

Fixes: #1903, #1915, #1936, #1937, #1882, #1893
@xairoo
Copy link

xairoo commented Oct 19, 2021

Can people following this thread test with npm i nodemon@debug and confirm if this works or not - this is the latest change with @immortalmind2016's changes.

Works 100%. Tested it about 50 times, restarted all the time (Windows) with 2.0.14 and 2.0.14-alpha.1

Tested also 2.0.12 again and also 2.0.13 and run into problems.

@immortalmind2016 great, thanks for this fix!

@remy 2.0.14 is live @ latest since a few minutes. You could close this issue.

@insyri
Copy link

insyri commented Oct 19, 2021

I didn't encountered any issues relating to this while using the alpha version last night, I even restarted nodemon extra times to make sure. LGTM!

@remy remy closed this as completed Oct 22, 2021
@Naeem775
Copy link

i have tried above mentioned versions (2.0.7 and 2.0.14) but no version is working for me on windows, it's stuck on restarting due to changes and i have to stop and start it manually.
any one can help?
image

@sharjeelfaiq
Copy link
Author

sharjeelfaiq commented Mar 31, 2022

i have tried above mentioned versions (2.0.7 and 2.0.14) but no version is working for me on windows, it's stuck on restarting due to changes and i have to stop and start it manually. any one can help? image

What version of windows are you using? Try finding the compatible version of nodemon with the version of windows and the IDE you're using.

@Naeem775
Copy link

Naeem775 commented Apr 1, 2022

@mrmalik16 i am using windows 10, and it was working fine before, i don't what happened to it suddenly, tried changing environment variables and installing different versions but no luck so fat

@DevonChia
Copy link

https://stackoverflow.com/questions/72758944/nodemon-does-not-auto-restart/72920135#72920135

I have found the solution if all the above recommendations doesn't work just like for me.

@Naeem775
Copy link

Naeem775 commented Jul 9, 2022

@DevonChia i uninstalled node and install it again and it's working now, may be problem with node path in environment variables

@DevonChia
Copy link

@DevonChia i uninstalled node and install it again and it's working now, may be problem with node path in environment variables

I have reinstalled many times but doesn't work, I guess the installation didnt manage to implement the variables correctly. Thus, I made the changes manually without the need to reinstall node

@CodeZak
Copy link

CodeZak commented Jul 13, 2022

this solution works for me: https://www.youtube.com/watch?v=a9fIZViTNEA&ab_channel=TechTalkNetwork
just follow what is on the video even if you don't understand the language.

@xetadeveloper
Copy link

I used powershell and it works fine, I'm guessing it may be an issue with cmd as on cmd it stays on "restarting due to changes"

@safil-badarudeen
Copy link

this solution works for me: https://www.youtube.com/watch?v=a9fIZViTNEA&ab_channel=TechTalkNetwork just follow what is on the video even if you don't understand the language.

this solution also worked for me. after doing this ,just restart your computer if it doesnt work after restarting vscode

@alzin
Copy link

alzin commented Feb 4, 2023

Oh my god, I am gonna kill myself.

After installing nodemon I was trying to run this

npm start

And it is actull should be

nodemon index.js

@Taha-Jarmouni
Copy link

This solution works for me after restarting vscode

https://www.youtube.com/watch?v=a9fIZViTNEA

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests