What triggers (re)install when no watch.json present?


#1

What triggers (re)install when no watch.json present?

If container has no package.json and no server.js, then I guess it never re-installs?


#2

Edits to package.json and .env file cause reinstalls by default. You can change that though with a watch.json file.

Node projects on Glitch need a package.json with a start command to work.


#3

I was not clear enough.
I think my container reinstalls sometimes without edits to either .env or package.json, so could there be something else that triggers it?

Btw, would it be possible to catch reinstall event and write the time of it in a custom log file? Custom log because built in log system dosnt seem to be persistent, or printable to a file?


#4

Oh, yes - an install is run every time your project wakes up. It’s almost all cached though it takes a fraction of the time of an install when stuff has changed. This isn’t something you can disable except by enabling npm rather than pnpm, which has the drawback of your node modules counting towards your project space.

You could write to a file with an install command in your package.json file.


#5

Ok, thank you.
Now I see what the problem actually was:

I just didnt notice it reinstalls every time on wake up as it was quick, but several times, in my case it would eventually complete installation, only not soon enough for client accessing the site connection would time out.

The reinstall now seems to be quick again.

But, is it really necessary to re-install everything on wake up? And just to confirm, it will reinstall on wake up even if package.json is not asking for the latest version of any module but only specific version already installed?


#6

Yes, it is necessary - we don’t do it for fun :slight_smile: It’s a side effect of how we provide you with the ability to use as many modules of whatever size in your projects for free. Usually, it’s not a problem due to caching, but our caching server was running a little slowly yesterday which may have caused the issue your described.


#7

Thanks for the explanation. Cheers.