TravisCI: Use custom Node.js version within container based builds
nodejs binary, custom version, second language
Sometime you may need a special version of Node.js or a recent version within a foreign build environment. But in the modern container-based infrastructure it is not possible to use apt to install custom packets which are not whitelisted. As an workaround, you can download pre-build binaries via wget into your build directory and add the bin/ dir to your PATH. This allows you to use any pre-build third party software without installation.
Example: PERL with javascript testcases#
os: linux language: perl perl: - "5.24" - "5.14" # skip perl (cpanm) dependency management # install nodejs into home folder install: # fetch latest nodejs archive - wget https://nodejs.org/dist/v8.8.1/node-v8.8.1-linux-x64.tar.gz -O /tmp/nodejs.tgz # unzip - tar -xzf /tmp/nodejs.tgz # add nodejs binaries to path - this has to be done here! - export PATH=$PWD/node-v8.8.1-linux-x64/bin:$PATH # show node version - node -v - npm -v # install node dependencies - npm install script: # syntax check - perl -Mstrict -Mdiagnostics -cw rsnapshot # run javascript based tests - npm test