Node restarts all the time?



I have built a really simple app with just a package.json and an app.js. App.js just write a message to the log. The thing I just don’t understand is why it keeps writing several messages like it restarts all the time. I hoped for one message.

I am a newbie to Glitch and node so I really don’t know where the problem is.


Glitch restarts node and automatically deploys your app as you’re editing it, so you always see the latest version when going to the app. Glitch apps also sleep after 5 mins of inactivity but wake again quickly whenever they’re needed, which also causes node to restart.

If you’d like to change the restart behaviour, it can be configured through use of a watch.json config file in your app. See for more info.


Thanks for your reply

Yeah, I know that is auto saves. I always get that nice notfication reminding me everytime I use cmd-s to save :slight_smile:

So the reason that it restarts for me is some kind of auto restart in glitch when I am in edit mode? I followed the link but didn’t understand it. Tried to throttle for 20 s and exclude app.js but console messages still pops up every 8 s.
I would like to run the app once and then run it next time I refresh page or something. I try to link to my project below.!/rabbit-amqplib


If you want to run your code when refreshing a page, define a route using Express and put your code inside it. Then whenever you hit that URL it’ll run.


Thanks for your help!