Package.json engines (don’t you dare forget to specify them)

One incredibly powerful tool for NPM is their package.json. It allows you to set the tone for what your project is going to contain, how it will run, and a million other things it seems like. It is a very powerful little file! And it’s all in JSON!

But like they say, “with great power, comes great responsibility”.

One very cool ability of a user’s package.json, that I have often times not seen people taking advantage of, is specifying their engines. In today’s day an age of NVM and our ability to quickly and easily hop between node versions (and in doing so, NPM versions), we lose track of exactly which combination of NODEjs/NPM work with certain projects.

This is where the developer(s) of the project should be using the engines property to set the tone for what works best with their project. It’s a simple add to their file and can certainly save others lots of time and headaches.

An example of specifying just your node and npm version is below:

"engines": {
    "node": "^0.10.x",
    "npm": "^2.11.x"

So I beg of you, if you are building something that has a package.json, do include the engines specification. I promise you others will be grateful.


One thought on “Package.json engines (don’t you dare forget to specify them)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s