kross kross - 2 years ago 160
Node.js Question

travis-ci ruby build with node 5

I've tried many things, but have ultimately failed to get the build for gulp-pipeline-rails running. The

runs locally, no problem.

The last problem I've narrowed down is that I have a
language project that utilizes node, but I need node 5. I found one snippet:

# Update the node version

- pwd
- rm -rf ~/.nvm && git clone ~/.nvm && (cd ~/.nvm && git checkout `git describe --abbrev=0 --tags`) && source ~/.nvm/ && nvm install $TRAVIS_NODE_VERSION
- npm install

While this seems to get node updated, it does something to my ruby env where it fails to execute rspec:

$ pwd && bundle exec rake
Could not find gem 'rspec' in any of the gem sources listed in your Gemfile or available on this machine.
Run `bundle install` to install missing gems.

With all that said, how do I simply use Node 5 with this

language: ruby
- 2.2.2
- ruby-head

- rvm: ruby-head

cache: bundler

# Setup
- node -v
# update npm
- npm install npm -g

# install Gulp 4 CLI tools globally from 4.0 GitHub branch
- npm install -g

# Build
script: bundle exec rake

Answer Source

Try using a before_install stage for adding a second language on Travis, maybe something like:

  - nvm install node

nvm should be installed by default on the Travis build image (depending on which one you're using), and this command will install the latest version of Node.

After that, maybe just have npm install -g gulp-cli@4.0 as the first step in your before_script stage (i.e. don't worry about updating npm), hopefully that should mean that bundler still runs fine and installs all your gems.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download