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.

Advertisements

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:

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s