[Bug] "YN0028: The lockfile would have been created by this install, which is explicitly forbidden", but `yarn.lock` exists and is not modified when running `yarn install` locally
See original GitHub issue- I’d be willing to implement a fix
Describe the bug
When I run yarn install and then git status I can see that there are no changes since the last commit, i. e. yarn.lock does not get modified by running yarn install.
Yet, when I push the commit to CI that has this GitHub Actions step:
- name: Install dependencies
run: yarn install
…it fails with:
2021-05-28T13:48:22.9912155Z [91m➤[39m YN0028: The lockfile would have been created by this install, which is explicitly forbidden.
2021-05-28T13:48:22.9913523Z [91m➤[39m YN0000: Failed with errors in 0s 12ms
2021-05-28T13:48:22.9918681Z ##[error]Process completed with exit code 1.
It’s weird that the error message is saying “created”. I was not able to google up any mentions of this specific error message. All mentions of YN0028 say “modified”, not “created”.
I believe this is a bug since doing yarn install locally does not modify yarn.lock, which exists and is checked into the repo.
To Reproduce
I do not have a minimal reproduction, but here’s a failing CI job: https://github.com/kaliber5/ember-bdd/actions/runs/885833497
It references a commit of a public open source project on GitHub.
I was able to work around the prpblem by setting the YARN_ENABLE_IMMUTABLE_INSTALLS env var to false. But it does not explain why Yarn is not able to use the lockfile.
Environment if relevant (please complete the following information):
- OS: Ubuntu 20.04
- Node version: 14
- Yarn version: 3.0.0-rc.2
Additional context
The project is a Yarn Workspaces monorepo.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:2
- Comments:10 (3 by maintainers)
Top Related StackOverflow Question
Running an install in your repo I see the same changes as the CI, some potential reasons:
.yarnrc.ymlfile withpackageExtensionshigher up the file treeyarn set version ...in your home directory so it’s using a different version than your CI (check~/.yarnrc.ymlfor ayarnPathconfig)I ran across the same issue. I resolve dit by deleting my cache and then reinstalling the dependencies.
The yarn.lock file was then modified by the time the reinstall had completed.
I believe this may have been because I checked in the cache folder initially, and then reverted it. Not sure if this then caused a discrepancy between my local environment and the checked-in repo.