Mismatch in `yarn install` and cache directory

I’m trying to deploy a Remix app, which is in a Yarn PnP monorepo. The build seems to run OK, but when it comes to the start command, I get a missing package error, with the following explanation:

Expected package location: /opt/render/.cache/express-npm-4.18.2-bb15ff679a-3c4b9b0768.zip/node_modules/express/

The repo has the packages installed into /opt/render/ROOT FOLDER/.yarn/cache. Using the shell, I’ve checked /opt/render/.cache, and it’s empty. Is there a way to either;

  • tell the web service to look in the correct directory, or
  • tell the install command to install into the /opt/render/.cache/ directory

Given the cache is part of the repo, it would make sense if we could do the former.

1 Like

Hi there,

Files that you want to be included as part of the image that’s then run, need to be in /opt/render/project/. The .cache path shared above would be a level too high. I’m not very familiar with Yarn Plug ‘n’ Play, but I expect there’s a way to configure the cache folder, maybe through an environment variable?


Yep, that makes total sense, and when running the build command, it is installing the files within the project directory. The issue was that when running the start command, it was looking for the packages in /opt/render/.cache rather than in the project directory.

I just had a successful build and start by setting the YARN_CACHE_FOLDER environment variable to ~/project/src/.yarn/cache, and the app is accessible now.

Thanks for the reply, hopefully this helps someone else stuck with the same issue

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.