NPM Shrinkwrap and TeamCity Build Fails

I’ll start by pointing out that I picked the title that was most similar to the search terms I used when trying to find out what was going on with my builds the other day! I couldn’t find any information to explain what I was seeing so here’s what I figured out…

What did you do!?!

Recently some people at work have been worried about possible inconsistencies in ours builds due to the ability for npm to get more up to date package versions depending on what we’ve added to the packages.json file. This never seemed to be the root cause of problems we’d encountered but if it meant taking it of the table as a possibility, it was going to make my life easier!

I ran npm shrinkwrap which, in basic terms, file called npm-shrinkwrap.json and lists out exact versions and locations for your dependencies and their subdependencies. There are pros and cons to this solution, but it was enough to satisfy members of the team that had concerns.

Until TeamCity started failing on every branch…


It took a little while to get to the root of this problem, but here’s the short answer:

Never fear…

This problem will solve itself when all of the other branches get in sync and are using the shrinkwrapped file, however while you’re waiting for this it can cause some confusing moments!

Hopefully anyone googling for what is going on I will have saved you a little bit of time.