Use node version from package.json



In node you can specify which version of node your app requires in the package.json file.

Today you have to specify the version in the circle.yml file so you need to maintain this configuration several places.

Circle CI should pick this configuration up and set the node version for the build accordingly, thus reducing the amount of duplicate configuration maintenance.

It also eliminates one or more cases where a build works locally but not on Circle CI, thus making Circle CI even more user friendly and intuitive.


Thanks for the feedback, this is a great idea!


The package.json engines field is a semver range.

How should Circle treat the range? A few possibilities:

  • Run the latest version that satisfies the range?
  • Or, the earliest version?
  • Or all the versions that fall in the range?


That is indeed a valid concern.

The default behaviour would probably be either the “run on the oldest version” or “run on the latest version”.

I’m unable to tell what the default behaviour should be. I’m unsure what best practices for this setting are. Personally I prefer to run on the latest version but I perfectly understand those who would prefer the oldest version. Someone else would have to chime in on this.

Whatever the default behaviour may be you should be able to override this setting in the circle.yml file if you don’t agree with the default setting.

Regarding running on all versions from X to Y:
I think CircleCi would have to impose some sort of restrictions in order to avoid having jobs that over time would take forever to run (just imagine today if you for some reason specify >=0.1).

I doubt free users would ever have access to a “run on all versions in the range”. It could be a thing for paying customers, Free users could be offered something like:

  • Run on the oldest version specified
  • Run on the latest version specified/available
  • Run on the calculated median version

I.e. let’s say you’ve specified something like >=0.9 and today the latest version is 4.2 (disregarding build versions for ease of example), the median would be version 0.12.

I don’t know if that would make sense for anyone to use.


I feel that the way to handle this is to use semver as npm would for a dependency. That means using the latest matching version.
For me, having this feature avoids having to duplicate the node version in circle.yml for the majority of cases, that’s all. Testing with multiple versions would almost always require separate, explicit configuration anyway.


In many instances, I have to check in a circle.yml file - which I dislike - solely to fix the Node.js version. I would be very happy to see this implemented. And there is existing precedent: Codeship does this! Please use the latest version that satisfies the semver in the engines.node field. There is also engines.npm, by the way.


Indeed CircleCI should read from package.json like any other app is doing (Heroku, CodeShip, TravisCI to name a few). This is quite a pain to checkout a circle.yml file, not that I dislike CircleCI but I prefer to keep my repo clean.


Would like to see this too


Is there any update on this improvement? It’s pretty dangerous to have these versions separated in case a test passes but would fail in production because someone forgot to update the circle.yml file (not saying it’s happened to anyone /s).


any progress on this? seems pretty crucial feature