nodemon app crashed waiting for file changes before starting как исправить

Why does this happen? Is Port 5000 already in use?

Here’s the terminal:

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

4 Answers 4

Go to Mongodb cluster and edit the IPwhitelist and refresh it

then connect it again problem solve.

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

That’s a typo.

Let’s get to the error.

That’s where your typo is.

The reason why you got the error message from » [nodemon] » is because you are using a development tool called nodemon for the server.

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

nodemon tries to restart the program for you anytime you encounter an error. Should you effect changes or make the necessary corrections you wouldn’t need to run the command node server.js again.

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

This is a very common error, when you start your server with nodemon, you might face this error. So, what this comes? and What is the solution?

ErrorReasons & Solutions:

First:

Maybe your PC running several processes in the Background. So you need to stop all the node process that are running.

Quick trick, Kill them all by running this on terminal :

or to kill a particular port instead of all

and then restart nodemon.

Second:

Server.js and package.json are not in the same folder.

Third:

You have written wrong code in your any of the file. So for that make sure you didn’t miss any JS syntax. If you did wrong code, here I’m talking about syntax error (not logic), then your nodemon will not start.

Источник

Comments

BramDecuypere commented Jan 18, 2016

I have this situation where I had a perfectly working app and all the request were not a problem at all. But after changing this piece of code:

After a few seconds my app crashes, although it sends the correct information to the
front-end? Anyone a solution? Because I have no clue how to fix this and at the moment I’m stuck.
The code doesn’t get into the console.log(‘ERROR ERROR ERROR’); part.

The text was updated successfully, but these errors were encountered:

We are unable to convert the task to an issue at this time. Please try again.

The issue was successfully created but we are unable to update the comment at this time.

remy commented Jan 18, 2016

Does this crash if you use node and not nodemon? (i.e. just running the 2nd code block).

allthetime commented Jan 19, 2016

@remy Hey, I have the same problem. Code that works with node, will crash nodemon, and it is ALWAYS because of console.log statements contained in callbacks that print referenced data.

So console.log(‘test’) will not crash nodemon, but console.log(db_results) or console.log(error) where db_results is an array of objects and error is a multi-line string will reliably crash nodemon.

My coworker doesn’t seem to have this issue, but I certainly do.

Removing console logs fixes the issue, but this isn’t exactly acceptable for obvious reasons.

I’m running the newest version of node (5+) on OSX

leslyarun commented Jan 26, 2016

@remy Hi, even I have the issue. If I run from node, it runs perfectly allright. But if i run from nodemon, its crashing :

allthetime commented Jan 26, 2016

Otherwise, it seems nodemon is watching too many files for my system to handle, I believe this is an issue with my own setup as much as it is with nodemon. When using a lot of node_modules (and some python libraries) there are A LOT of files to watch, most of which I don’t need to watch. I have attempted to use nodemon.json to exclude certain patterns. «node_modules/**» for instance, but it doesn’t seem to have any effect.

pursual commented Jan 31, 2016

Had this issue with node ver 4.2.6, but not when downgrading back to 4.2.2.

michaelBenin commented Feb 5, 2016 •

Also having this issue with 4.2.6

remy commented Feb 5, 2016

Has anyone attempted to debug this yet?

Neta-Alon commented Apr 30, 2016

Hey guys,
I had it happen to me, don’t know if for the same reason.
My problem was I forgot to close pm2 running my production version before attempting to start nodemon.
Only after a while did nodemon give me an error saying it can’t listen on the already bound port.

xiaofan2406 commented May 11, 2016

It happened to me as well. It crashes without giving any other error message.
I closed all the terminal window, and restarted it. Then it works again.

seanfuture commented Jun 3, 2016

kingram6865 commented Jul 27, 2016

Does someone have a solution as opposed to confirming that this is a problem?

samiraguiar commented Jan 28, 2017 •

praWINK commented Apr 8, 2017

I am also having this same issue anyone could solved that.

Massimoivaldi commented Apr 20, 2017

Don’t ask me why but if i change the port (it was 300 i put 3000) nodemon doesn’t crash anymore.

shubhamduttasd commented Jun 14, 2017

mine is 3001 so what should i put?

am-firnas commented Jul 2, 2017

worked for node 5.6.0 version.

shikya commented Jul 22, 2017

node => v6.10.0
npm => 5.3.0
nodemon => 1.11.0

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

MrBeboApp commented Oct 29, 2017

avinashpj commented Nov 27, 2017

Temp solution: I have changing port when this error msg come, its working.

remy commented Dec 14, 2017

tech2crave commented May 8, 2018

I have the same problem as many here.. I am new to node.js.. and while I have been reading your comments.. there is a possibility that the issue is nodejs version running with certain version of nodemon.. i am wondering what versions are you guys using..

remy commented May 8, 2018

@tech2crave I’d suggest opening a new issue with details of what you’re seeing. The original issue was opened 2 years ago when node support was very different. Node 8 should be very well supported, so if you file the new issue with full information on how to replicate, that would be perfect

kumaresan-in commented Jun 2, 2018

here you will have a solution in simple steps

TaoWang317 commented Oct 29, 2018

mukuljainx commented Feb 3, 2019

Hey everyone, updating nodemon from version 1.18.6 to 1.18.9 fixed the issue for me.

corysimmons commented Feb 25, 2019

After some digging (removing code) I figured out it was buggy middleware. I suggest if anyone else is running into this while using Express, to do the same.

thisilvafarias commented Feb 25, 2019

erics2783 commented May 7, 2019 •

MiguellAngelhs commented Jun 21, 2019

Many times we closed the PC and left the project running, when we used it again and ran the project again, that error appeared. I always solved it, restarting the pc. Everything worked perfectly.

kphareesh1994 commented Aug 16, 2019

aricjean commented Nov 27, 2019 •

I had it happen to me, but I just figured it out.

sakshiseth commented Jan 17, 2020

fkcailiniyazi commented Feb 14, 2020

It happened to me also when I tried to run nodemon from CLI, but after I added it into my package.json script and run with npm it works, I don’t know why, but hope this helps.

ionicstuff commented Mar 27, 2020

@aricjean thank you bro, it worked for me.

CinatitBR commented Mar 30, 2020

Try to open the task manager and kill the node.js processes.

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

analopesdev commented May 2, 2020

vikramvi commented Oct 16, 2020

Issue still exists with below setup, tried all the steps mentioned above but none of them worked.
I’m working on MERN stack project

You can’t perform that action at this time.

You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.

Источник

Want to improve this question? Update the question so it’s on-topic for Stack Overflow.

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

7 Answers 7

Borrowed from my answer to this question:

Install the kill-port node package as a dev dependency:

Create a nodemon.json file in the root of your project containing:

Then, in your package.json file, have something like this:

Then start your app in dev mode with:

nodemon app crashed waiting for file changes before starting как исправить. Смотреть фото nodemon app crashed waiting for file changes before starting как исправить. Смотреть картинку nodemon app crashed waiting for file changes before starting как исправить. Картинка про nodemon app crashed waiting for file changes before starting как исправить. Фото nodemon app crashed waiting for file changes before starting как исправить

Killing a process that owns port 3000

Unix-like Operating Systems (e.g. GNU/Linux, FreeBSD, macOS)

First, let’s take a look at how we can kill a process that has a port open.

Using the lsof command, we can retrieve the PID that has the given port:

Then we can kill this process just by doing:

Let’s turn this into a one-liner:

If you’re using environment variable to set the server port, we can specify that instead of hardcoding our values:

Lastly, we can default to port 3000 if environment variable isn’t set:

Microsoft Windows

Unless you’re running nodemon on Windows Subsystem for Linux (WSL), lsof is not available in Windows. However, netstat is available on Windows shell:

This will return the PID of the process that is using up port 3000 which we can use to kill the process using tskill command:

If all you care about is making sure the process that owns the port is dead without any graceful shutdown, you can disregard the caveat below.

Caveat on Windows process kill behaviour

If your app listens in on SIGTERM to shutdown gracefully when nodemon triggers tskill command, Windows will unconditionally terminate your process before your app has a chance to fire the process.on(‘SIGTERM’) event handler.

More details on this caveat are here:

Sometimes the tskill command won’t run due to some reasons. You can also use the following command for killing the process after finding the PID from the above netstat command

Getting nodemon to execute hooks

Nodemon lets you set up event hooks through nodemon.json configuration file:

For more info on nodemon events, checkout their documentation:

Источник

Добавить комментарий

Ваш адрес email не будет опубликован. Обязательные поля помечены *