Project code keeps looping

Any project I make, when I make ANY changes(especially to the package.json file) the code runs again as it should, but the problem is that it keeps on running over and over again. This happens to all project I make. Please fix it. Seems to be a problem with my account only.

I typed console.log("Hi") in index.js and it kept on logging it after a few seconds. The code kept on looping. But when I deleted package.json it stopped. It seems there is a problem when downloading packages like node or something else.

This issue has been happening since yesterday. I thought it would fix itself but it didn’t.

Example project’s name is ringed-drop-k9mavy34de

That’s normal, intended behavior. If the process started by Glitch (the one that you specified in your package.json .scripts.start, “node index.js”) exits, even if it exits “happily”, then Glitch starts it again.

If you look at ~hello-express, you can see that it opens a server listening for incoming connections. If you imitate ~hello-express and also have a long-running process, such as a web server, then you will see it last for much longer - probably 5 minutes even if you do not keep the Glitch project awake by sending it web traffic.

Hope this helps,

Johnicholas

1 Like

But what if I want to host like a Discord bot? It would keep on logging again and again and Discord would change the bot’s token and I will have to change the code.

Also my glitch project doesn’t wake up. And when I want to set up something like to pick up HTTP requests it times out.
Screenshot_2

You might look at ~starter-discord and this blog post about it - https://glitch.com/culture/discord-bot-starter-making-your-first-bot-easy/.

Hope this helps,

Johnicholas

1 Like