Skip to content

Instantly share code, notes, and snippets.

@sandfox
Last active December 18, 2015 16:58
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sandfox/5814694 to your computer and use it in GitHub Desktop.
Save sandfox/5814694 to your computer and use it in GitHub Desktop.
Latest / custom nodejs versions for travis.
before_install:
- rm -rf ~/.nvm
- curl https://raw.github.com/creationix/nvm/master/install.sh | sh
- source ~/.nvm/nvm.sh
- nvm install ${TRAVIS_NODE_VERSION}

If you want to use a custom version of node.js that isn't installed by default on travis you may have noticed that the version of nvm on travis is old / slightly nobbled insofar as it can't access anything remotely to pull down or know about latest versions.

By boshing the above in your .travis.yml, the supplied nvm script will be overwritten by a fresh copy from github and then it will install the highest version of nodejs available publicly that satisfies the nodejs version you supply elsewhere in your .travis.yml

This does bring in lots of external dependencies such as github and nodejs website which maybe a problem for you (but you're probably pulling in stuff from npm anyway). Speed wise it seems to make little difference to the overall test runtime.

You could probably ease this by bundling nodejs binaries etc etc if you really care.

@joshk
Copy link

joshk commented Jun 19, 2013

We updated the Node VM template yesterday and nvm should now be more up to date.

Does this compile Node during install or does it fetch a prebuilt binary?

I would be happy to talk about changes to Travis to make this easier.

Also, on that note, all Node versions have been updated as well.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment