Fallback to .nvmrc if Node version not specified


#1

For projects that use NVM, it would be great to fallback to the .nvmrc file if a Node version isn’t specified in circle.yml. This would allow for a DRYer config and guarantee that devs working locally (i.e. nvm use) are using the same version as CircleCI.

Travis CI follows this paradigm: http://docs.travis-ci.com/user/languages/javascript-with-nodejs/#Using-.nvmrc.


Different node versions per directory?
#2

Yes, please! Our developer tools follow the same convention – they invoke nvm use – and right now we have to keep .nvmrc and circle.yml in sync. If the inference checked .nvmrc we wouldn’t need to do this – and also plenty of builds would tend to “just work” without any config.


#3

This would be extremely helpful


#4

Completely agree. If a node version is not specified in the circle.yml, but there is a .nvmrc, seems logical to call nvm use and set that version as the default for everything following.

Until then, I’ve been putting this snippet in every circle.yml:

checkout:
  post:
    # Use the node version declared in .nvmrc
    - nvm use && nvm alias default $(nvm current)

Of course, if nvm was enhanced to use the circle.yml file that would work for me too. :slight_smile:


#5

This might be useful at some point. Just leaving this here:

https://stackoverflow.com/questions/23556330/run-nvm-use-automatically-everytime-theres-a-nvmrc-file-on-the-directory


#6

This is a bit old now. is this doable/possible for 2.0?


#7

@levlaz Any chance we could get this feature implemented?


#8