Have to reinstall subdirectory node modules every day


Hi there,

I have two package.jsons in my app, one at the root and one in a subdirectory, placed there by create-react-app. Every time I come back to my project after overnight or more, I have an error saying the app can’t find the React scripts which is fixed by going to the subdirectory and doing pnpm install. It’s basically fine because I know how to fix it, but I was hoping to find out if this is a common error or something I’ve misconfigured in my app. It’s a little bit annoying so I’d like to stop doing it if possible. :sweat_smile:


2 package.jsons

Hi @garann sorry for the delay here. I wanted to double check what I’m going to tell you and I had a dickens of a time getting a working example. I think I have one now, although my remix of one of your projects that fits the bill doesn’t actually work, but I think the errors are not pnpm install related but are instead related to the fact that I don’t have the proper .env set up.

I think what would work for you is to add an install script to your main package.json that executes the install you’re having to do manually right now. something along the lines of "install":"cd /app/client && pnpm install && cd /app".

How I think that will help is that I think you’re running into the every-12-hour container restart. Glitch will run the contents of the “install” script when the project starts up and runs it’s install step, so this should do what you’re doing manually without your hands-on involvement.

Let me know if this works for you!

2 package.jsons
2 package.jsons

Hi @cori! Thanks very much for the fix. That worked automatically and cleared the errors. I appreciate the help!