I'm Siegfried. A developer. Yep.

ng-semver, a story about angular, semver, npm, and fails

A small story

I work on a pretty cool project (Node.js + Angular.js 1.5.8). I even use Webpack !

I use npm to manage my dependencies, for the back and for the front.

I use Jenkins, which is pretty cool, with the following steps:

This week, our latest image was used and the app was not working at all.

MRW I launch the app…

What happened

Angular.js 1.6.0 was released. And it contains breaking changes.

But alors… Angular follows semver, right ?

Yes and no.

Angular.js (v1) does not follow semver, Angular (v2+) does.

But alors… Semver ?

Semver may or may not be perfect, it is what is used on npm.

Here is what semver defines versioning:

Given a version number MAJOR.MINOR.PATCH, increment the:
MAJOR version when you make incompatible API changes,
MINOR version when you add functionality in a backwards-compatible manner, and
PATCH version when you make backwards-compatible bug fixes.

That is basically it.

But alors… Npm ?

The classic thing with npm is a package.json file.


As a bare minimum, a package.json must have:

all lowercase
one word, no spaces
dashes and underscores allowed

in the form of x.x.x
follows semver spec

Let’s check some other stuff from npm package.json docs


The most important things in your package.json are the name and version fields. Those are actually required, and your package won’t install without them. The name and version together form an identifier that is assumed to be completely unique. Changes to the package should come along with changes to the version.

Version must be parseable by node-semver, which is bundled with npm as a dependency. (npm install semver to use it yourself.)

More on version numbers and ranges at semver.

So, if you put your libs on npm, it is recommended to follow semver.

When you install things from npm and check your package.json, the version are prefixed:

The prefix can be configured, and the default is ^.

This mean that if you do not follow semver, running npm install will get you the last minor version.

That is the case of Angular.js v1: we were expecting “^1.5.8” and got a brand new breaking 1.6.0.


Last point: it is freaking crazy how much energy and time the Angular marketing/dev team put into a shitload of fails:

To finish this article/rant, a fun little piece of advice to the Angular team:

About versioning, @angularjs should use:
- odd major numbers for Angular.js
- even major numbers for Angular