question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error after upgrade prevents `package.json` and `yarn.lock` from being updated

See original GitHub issue

When I try to upgrade a dependency (using yarn upgrade) and I get a new patch failure error from patch-package, I’m left in a weird state where my node_modules do reflect the changes, but my package.json and yarn.lock do not.

My presumption is that the patch-package error stops Yarn from commiting the update to the manifest and lockfile. I’m not sure this is desired behaviour, or whether this is a patch-package problem or a Yarn problem.

Because of the error message, I thought it was safe to go in and re-apply my patch. So I edited node_modules and ran patch-package to generate the new patch, but because the upgrade was not committed, patch-package created a patch of a diff between the version before the upgrade and the version after the upgrade with my changes, which took me awhile to realise.

If we can’t fix the bug whereby upgrades are not committed due to the error, we should provide clearer steps in the error message to avoid this.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:6 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
ds300commented, Jan 20, 2019

Hi @OliverJAsh I figured out a pragmatic solution: calling exit(1) on CI and exit(0) locally. That prevents the confusing upgrade issues while also preventing bad patch files from sneaking past CI, without adding any extra commands. I’ll publish a fix for this shortly.

0reactions
OliverJAshcommented, Jan 21, 2019

Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

yarn.lock file is not updating after I update the version of a ...
json and yarn.lock files. I'm updating the version of a particular package from version 2.0.14 to version 2.0.16 .
Read more >
How Yarn Lock Files Work and Upgrading Dependencies
This article has a goal of explaining the purpose of a yarn.lock file as well as how to upgrade dependencies when a lock...
Read more >
Yarn lock: how it works and what you risk without ...
This decreases the size of your project and prevents potential conflicts between different versions of the same package. Updating the lockfile.
Read more >
Error Codes | Yarn - Package Manager
The easiest way to fix it is to use git checkout --theirs yarn.lock , and follow up with yarn install again (which can...
Read more >
Why Running `yarn upgrade` Does Not Update My ` ...
If we run yarn upgrade without any flags, it will install the latest version that matches the version pattern indicated by package.json ....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found