ruby - 使用 Node 5 构建 travis-ci ruby

标签 ruby node.js travis-ci

我尝试了很多东西,但最终未能获得 gulp-pipeline-rails 的构建运行。 脚本 在本地运行,没问题。

我缩小范围的最后一个问题是我有一个使用 Node 的 ruby 语言项目,但是 I need node 5 .我找到了 one snippet :

#------------------------------
# Update the node version
env:
  - TRAVIS_NODE_VERSION="5"

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

虽然这似乎更新了 Node ,但它对我的 ruby​​ env 做了一些事情 fails to execute rspec :

$ pwd && bundle exec rake
/home/travis/build/alienfast/gulp-pipeline-rails
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.

问题 话虽如此,我如何通过这个 .travis.yml 简单地使用 Node 5?

language: ruby
rvm:
  - 2.2.2
  - ruby-head

matrix:
  allow_failures:
    - rvm: ruby-head

cache: bundler

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

  # install Gulp 4 CLI tools globally from 4.0 GitHub branch
  - npm install https://github.com/gulpjs/gulp-cli/tarball/4.0 -g

#------------------------------
# Build
script: bundle exec rake

最佳答案

尝试为 adding a second language 使用 before_install 阶段在 Travis 上,可能是这样的:

before_install:
  - nvm install node

nvm 应默认安装在 Travis 构建镜像上(取决于您使用的是哪个),此命令将安装最新版本的 Node。

在那之后,也许只需将 npm install -g gulp-cli@4.0 作为 before_script 阶段的第一步(即不要担心更新 npm) ,希望这应该意味着 bundler 仍能正常运行并安装您所有的 gem。

关于ruby - 使用 Node 5 构建 travis-ci ruby,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36224163/

相关文章:

node.js - 在 Electron BrowserWindow 中进行全文搜索

travis-ci - 如何自定义/覆盖 Travis CI 中的 "git clone"步骤?

node.js - 使用 Spectron 和 Travis 测试 Electron 应用程序

ruby-on-rails - 如何为 Rails map 配置文件配置 Google Maps?

ruby - Mongo::OperationFailure - 使用 from_uri 时需要登录

node.js - 将异步等待与 setImmediate 结合使用

node.js - 我可以在没有互联网连接的情况下安装 Express 吗?

node.js - 特拉维斯cmd命令

ruby - 使用 axlsx gem 向 Excel 工作表中的单元格添加注释

ruby-on-rails - 如何清理 Rails 中凌乱的 View 和 Controller ?