To Alcohol and WiFi!
The causes of, and solutions to, all of life’s problems.
It isn’t often that an intermittent network connect is a benefit, but in this case a connection hiccup actually tipped me off to a useful workaround.
When you’re an engineering manager, you’re “important”, which means you have to go to a lot of meetings. And because you’re so very “important”, you can’t be troubled to close your laptop when walking across the office to said meetings, because you might miss someone’s giphy on Slack. Pretty sure I looked like an idiot, but that’s the price you pay for being in charge. Or something.
Anyhow, I’d been fighting an npm
issue all morning (natch), where a particular module (bcrypt
) was core dumping on my Mac. Not cool, bcrypt
, not cool. Couldn’t figure out what was going on, but as is typical, “have you tried erasing your node_modules
folder and re-running npm install
?” Actually I had, but I was getting desperate, so thought I’d give it one more go. While simultaneously picking up my laptop to head to a meeting (keeping it open as I walked, because “important things” happening on it).
I arrived at the meeting (no idea what it was about, also pretty typical), and when the npm install
had finally finished, I tried the program again, and lo and behold, it worked! I think at this moment I audibly exclaimed my excitement, despite the outburst not fitting the context of the meeting, that’s how happy I was. But I was also a bit befuddled. What had changed?
So I pored over the logs, both from the install that didn’t work, and the one that had (God bless anyone that ever has to review an npm
log, it’s a special kind of hell). Check out extracts from the install that failed to run, and the one that worked. Do you see the difference?
Please go look. I’ll wait.
Figure it out?
Did you notice that the binary of bcrypt
failed to download in the second log, and npm
fell back to compiling from source? That was the secret! Something must’ve been wrong with the prebuilt version for Mac. Now, I never solved what caused the crash in that build, but it was easy enough to work around it with npm --build-from-source
.
But the real serendipity was the likely cause of the download failure. The only explanation I can think of is that our office’s crummy WiFi happened to flake out briefly as I was carrying my open laptop across the hall, just at the moment when the bcrypt
binary was being downloaded, causing it to fail. But the network was back by the time the source tarball was downloaded, and the reset of the process finished normally.
Even as I write, it sounds preposterous. What are the odds? Maybe it was something else, I don’t have any proof. But you’ll never convince me.