I need to use grunt during the installation of my project. I need node.js >= 0.8 for that. but the version included in a python VM in Travis CI is the 0.6.
I tried downloading the last binaries and inserting it into the PATH but I couldn't export the variable correctly, and if I changed it using the env: parameter of travis it would not have had the rest of the PATH.
If I use directly the binaries (./node-v0.10.22-linux-x64/bin/npm install ...
), it will install them in ./node-v0.10.22-linux-x64/bin/
and when I want to use grunt, it will call bower (one of the task) but it will fail. (Fatal error: Failed to execute git checkout e6f8a58dbce5858586564a1ba4543f122ef63225, exit code of #128).
So, what is the best solution to update node.js and install binaries I need to use them in Travis CI?
Travis CI is a Continuous Integration service used to build and test software projects hosted at GitHub. Or in simple terms, when you push a commit to the master branch of your project hosted at GitHub, Travis CI will run tests and build the latest commit of your master branch. It's that simple.
npm precisely when npm ci is the default script command. (See above.) In all other cases, this will cache node_modules .
Here is a modified version of the Travis config that I have been using. The steps to get node installed are adapted from node's install docs. This method will install the latest stable version of node.
language: python
python:
- "2.7"
- "3.3"
install:
# Python test requirements
- pip install -r requirements.txt
- pip install nose coverage selenium
# JavaScript test requirements
- sudo add-apt-repository -y ppa:chris-lea/node.js
- sudo apt-get -y update
- sudo apt-get -y install nodejs
- sudo npm install -g grunt-cli
- sudo npm install -g bower
- sudo npm install
before_script:
- bower install
script:
# Run Python tests and generate coverage statistics
- nosetests --with-coverage
# Run tests for JavaScript
- grunt test
# etc., etc.
Travis CI's Trusty beta comes with "A mega image which will contains almost all of (soon to be all) our commonly supported runtimes and services."
To use it, add this to your .travis.yml:
sudo: required
dist: trusty
For example:
sudo: required
dist: trusty
language: python
python:
- 'pypy'
- 'pypy3'
- '2.6'
- '2.7'
- '3.2'
- '3.3'
- '3.4'
- '3.5'
script:
- python --version
- node --version
At the time of writing, this contains Node v4.1.2 instead of v0.10.36.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With