首页 > 解决方案 > 运行 Travis 构建时找不到 Railties 和 RSPEC-core gem

问题描述

.travis.yml

language: ruby
rbenv:
- 2.5.3
addons:
  postgresql: 9.6
cache:
- bundler
script:
- bundle exec rails db:{create,migrate} RAILS_ENV=test
- bundle exec rspec RAILS_ENV=test
deploy:
  provider: heroku
  api_key:
    secure: ZGGukZZY5raHE4s5iTNywLdGiJr6cOn7uE11zQyj/zCMTgl1sC73dp0jgm30w3Oh2qmV0Ilzd4t4u0OJRp0SuT0x0vDe8xLcWZOuzEn4beI9p5oKaXe6PHuZBWK+7X0P28k9cBjqUBkM7V/P0SN4rvdZT9PGGVXC+PvvET/9TBLV2iDP+TaUuM9e0XONq4Vx16M5LeoWmiyLVsMioojnmJbEiKiRSSFpvY5Lo7K7gFvUA3BATVxmIB4ATBTVV2iULQALxkmntDhtQnW9/zCjusc9/QyF74/I5QHjslmtMwURT8NFTBh9wQXL/r2a0WzsQQU7kzcGyLPICDs3sg3pGG//muOpXbMP1pLBoCtIi4ONr/LDQyZzfpZC915G+EORptlBULNgUlfP9aAl9SqB74WXHsKF227/GY134U+Wi4la41YgBswu7qYVnxMO5/tSQJH0LjH7q9tRncCXau7r++D/KewWSIW9LClud+8WheChmpgBHkZA0BU854JYfAajGWM/YZ+Ij5VTd3TBPSBiy2+fs5EbWYrjPOQcd7b5Hfces+8iDGfTAesNBmSJvMQGmHwM2/kDqRcm6/O3M7B9wHNuXDsRHoxC2XbpojWQ2UcEXj5a40IEp+qh+HwC70lgjxpfJHM0/Gn4WEbv0jkQ6/VEJu/1NjhzqZCh8TsgP5s=
  app: gone-hiking
  on:
    repo: kaiheiongaku/gone_hiking

特拉维斯的输出

$ export BUNDLE_GEMFILE=$PWD/Gemfile
cache.1
Setting up build cache
cache.bundler
0.00s2.02sadding /home/travis/build/kaiheiongaku/gone_hiking/vendor/bundle to cache
ruby.versions
$ ruby --version
install.bundler
0.40s$ bundle install --jobs=3 --retry=3 --deployment --path=${BUNDLE_PATH:-vendor/bundle}
0.31s$ bundle exec rails db:{create,migrate} RAILS_ENV=test
/home/travis/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:374:in `block in replace_bin_path': can't find executable rails for gem railties. railties is not currently included in the bundle, perhaps you meant to add it to your Gemfile? (Gem::Exception)
    from /home/travis/.rvm/rubies/ruby-2.5.3/lib/ruby/gems/2.5.0/gems/bundler-2.1.4/lib/bundler/rubygems_integration.rb:402:in `block in replace_bin_path'
    from /home/travis/build/kaiheiongaku/gone_hiking/vendor/bundle/ruby/2.5.0/bin/rails:23:in `<main>'
    from /home/travis/.rvm/rubies/ruby-2.5.3/bin/ruby_executable_hooks:24:in `eval'
    from /home/travis/.rvm/rubies/ruby-2.5.3/bin/ruby_executable_hooks:24:in `<main>'
The command "bundle exec rails db:{create,migrate} RAILS_ENV=test" exited with 1.
0.09s$ rspec
The program 'rspec' is currently not installed. To run 'rspec' please ask your administrator to install the package 'ruby-rspec-core'
The command "rspec" exited with 127.
cache.2
store build cache

根据我在其他地方看到的情况,我尝试了不同的更改,但我无法让 Travis 识别 rspec 和 railties。两者都在我运行时列出gem list

我最好的猜测:它与 Rails 版本控制有关。我已经尝试重新安装捆绑器和导轨,但到目前为止没有任何变化。

标签: ruby-on-railstravis-ci

解决方案


推荐阅读