The other day, a developer on my team decided it was a good idea to leave a pull request half done before going on holiday. So, I went to pick this ticket from the board in order to clear-out things and start shipping the product out of the window … It was somewhat quite hard to understand and solve … so I decided to write here what happened, maybe someone could benefit from it …
So, there was me, all alone with that issue what was “potentially” a quick fix ….
First things first, lets check that the build is green and CI automation is happy …. I Went to Codeship and oh my dear, someone else outside of my team (probably the maintainer of the module) decided it was a good idea to just delete a existing package from the yarn registry (who cares right?). Consequently, the build is now failing and the error is quite bizarre.
2017-07-11T07:23:12.288Zerror An unexpected error occurred: "https://registry.yarnpkg.com/acorn/-/acorn-4.0.12.tgz: Request failed \"404 Not Found\"".
Screenshot from Codeship:
Without being able to believe myself / understand the error, I wondered “Someone is definitely doing something nasty” … So I retried the build 3 times … all ending up with the same error.
So I went to double check that module Yarn is complaining about, with curl I checked for the package URL (To find out the obvious, it was deleted):
Yes, it have been deleted. Somehow yarn can’t figure out a solution for it. The author of the pull request said:
With no time to loose, I went deeper into the pull request … for minutes I was fighting with Yarn, NPM … all resulting in the same dead end, that dependency somehow always get written inside the yarn lock file, causing the build to fail.
Ok, so lets delete the yarn file and the new one should be good right ? no more issues like that, right ?
No, this time, after deleting the yarn lock file and generating a new one, I’m having some weird tests that where working before, to fail with even more strange error:
TypeError: this.context.getStore is not a function
I wonder with myself, what next ? should I fight to fix this error, or should I stick with the old one ?? Fight with Yarn or with the new downloaded yarn dependencies that broke this poor project apart ?
I looked at the clock, the day is about to end, and I have to get this out of the window, and fast. So I decided it was about time to get this done, and fast.
I went on Yarn lock file and analyzed it “line by line”, its was about 8.000 lines … so I finally I found the culprit:
acorn@^4.0.3, acorn@^4.0.4: version "4.0.12" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.12.tgz#335679ab819ec3c78772fe0c2c2f4bfa4359854e"
So I went on the web and tried to reach out the github repo for acorn … there is no such version 4.0.12, only 4.0.11 or 4.0.10:
So I was like, OMG how the hell this happened (??), I’m looking at the right acorn ? What to do ? I decided to try my luck with version 4.0.13 ? and TADA, that works like a charm:
acorn@^4.0.3, acorn@^4.0.4: version "4.0.13" resolved "https://registry.yarnpkg.com/acorn/-/acorn-4.0.13.tgz#105495ae5361d697bd195c825192e1ad7f253787"
After so many years doing this, I remember, with NPM it (Or … in the old times Maven) it was nothing different … so I was wondering, is Yarn package manager, a bless or a curse ? Is solving something for real or the issue is just now a little less worse ??
You tell me.
Happy opensource coding to everyone! 😀