Switching to the yarn zero installs approach (see https://yarnpkg.com/features/zero-installs) I encountered errors in the following style when running our CI pipeline:
/app/.pnp.cjs:47262
throw firstError;
^
Error: Required unplugged package missing from disk. This may happen when switching branches without running installs (unplugged packages must be fully materialized on disk to work).
Missing package: nodemon@npm:2.0.7
Expected package location: /app/.yarn/unplugged/nodemon-npm-2.0.7-7b95e46511/node_modules/nodemon/
.
.
.
Ok, that was expected, since this approach doesn't run yarn install
and just uses the files from the cache in .yarn
. Following the advice in the last point of this paragraph https://yarnpkg.com/features/zero-installs#how-do-you-reach-this-zero-install-state-youre-advocating-for I adjusted my .gitignore
and .dockerignore
files to include this:
.yarn/*
!.yarn/cache
!.yarn/patches
!.yarn/plugins
!.yarn/releases
!.yarn/sdks
!.yarn/versions
!.yarn/unplugged
The unplugged folder should therefore be able to be committed to the repo and with that, available during the CI pipeline. But as you can see, the files of each package in the unplugged folder remain greyed out and cannot be committed.
The output of git status --ignore
still lists the unplugged
dir, even after checking all .gitignore
files:
.yarn/.DS_Store
.yarn/build-state.yml
.yarn/cache/.gitignore
.yarn/install-state.gz
.yarn/unplugged/
What can I do to get the files into the repo or otherwise avoid the error mentioned in the beginning?