yarnpkg / yarn

The 1.x line is frozen - features and bugfixes now happen on https://github.com/yarnpkg/berry
https://classic.yarnpkg.com
Other
41.39k stars 2.73k forks source link

Use of `yarn-offline-mirror` and the yarn cache leads to missing packages in offline mirror. #8361

Open SirensOfTitan opened 3 years ago

SirensOfTitan commented 3 years ago

Bug description

We check all of the tgz of our packages into source control, and run our CI in offline mode for generally reproduce-able builds. Occasionally, when we're dealing with package upgrades, we get into a state where yarn doesn't put the package into yarn-offline-mirror directory when the package exists inside the local cache (at yarn cache dir).

Command

yarn install foo@6.0
# maybe we decide against it after playing with the upgrade, so we revert package.json
yarn install foo@5.0
# ... then later on: we install 6.0 again, it's a cache hit in `yarn cache dir`, so `yarn-offline-mirror` is not included in the git repo, causing CI to fail builds.
yarn install foo@6.0

What is the current behavior? Currently, yarn is not populating the offline-mirror directory if it experiences a cache hit in the yarn cache dir system cache.

What is the expected behavior? Yarn should always install the tgz of packages as specified in yarn.lock regardless of the contents of the system cache. It could perhaps just copy the package archive if it experiences a hit in yarn cache dir.

Steps to Reproduce I haven't tested this, but it goes something like (also above):

yarn install foo@6.0
# maybe we decide against it after playing with the upgrade, so we revert package.json
yarn install foo@5.0
# ... then later on: we install 6.0 again, it's a cache hit in `yarn cache dir`, so `yarn-offline-mirror` is not included in the git repo, causing CI to fail builds.
yarn install foo@6.0

Environment

pedroteixeira commented 2 years ago

is there really still an open issue if using yarn offline mirror?

robgallen commented 4 months ago

Ran into this issue recently. Yarn 1.22.19, Node 18.19.1, Windows 10 I ran yarn cache clear and then yarn install and a load of packages appeared in my offline mirror, which I use for CI/CD build on a build server that has no internet access.