0

Jenkins CI サーバーがあり、次のビルド スクリプトを実行するとエラーが発生します。

rdoc spec

エラーは次のとおりです。

/usr/bin/ruby1.9.1 -S rspec spec/requests/home_spec.rb
/home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:88:in `block in materialize': Could not find json-1.6.5 in any of the sources (Bundler::GemNotFound)
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `map!'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/spec_set.rb:82:in `materialize'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/definition.rb:90:in `specs'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/definition.rb:135:in `specs_for'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler/runtime.rb:11:in `setup'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler.rb:117:in `setup'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
    from /var/lib/jenkins/jobs/App1/workspace/config/boot.rb:10:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /var/lib/jenkins/jobs/App1/workspace/spec/spec_helper.rb:11:in `<top (required)>'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from <internal:lib/rubygems/custom_require>:29:in `require'
    from /var/lib/jenkins/jobs/App1/workspace/spec/requests/home_spec.rb:1:in `<top (required)>'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `block in load_spec_files'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `map'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/configuration.rb:698:in `load_spec_files'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/command_line.rb:22:in `run'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:80:in `run_in_process'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:69:in `run'
    from /home/zeck/.rvm/gems/ruby-1.9.3-p0/gems/rspec-core-2.8.0/lib/rspec/core/runner.rb:10:in `block in autorun'
rake aborted!

これが私のRakefileです:

require 'rdoc/task'
require 'rspec/core/rake_task'

desc 'Generate test result'
RSpec::Core::RakeTask.new(:spec) do |t|
  t.pattern = 'spec/*/*_spec.rb'
end

そして、ここに私のGemfileがあります:

source :rubygems

# Required gems
gem 'sinatra', '>= 1.3.2'
gem 'rdoc', '>= 3.12'
gem 'rake'
gem 'json', '>= 1.6.5'

group :test do
  gem 'rspec', '>= 2.9.0'
  gem 'rack-test'
  gem 'simplecov', '>= 0.6.1', require: false
end

わかりません。私を助けてください。RVM で Ruby 1.9.3 を使用しています。

毎度アドバイスありがとうございます。下手な英語でごめんなさい:)

4

1 に答える 1

1

おそらくその理由は、Jenkins がビルドを実行している環境が、ビルドを実行している環境とは異なるためです。

通常、違いは、Jenkins ではなく、ユーザー用に設定された環境変数によって引き起こされます。

コマンドを実行して、環境変数を確認できますenv。Manage Jenkins -> System Information で Jenkins の環境を確認できます。

いくつかの環境変数を設定する必要がある場合は、Manage Jenkins -> Configure System で実行できます。

于 2012-04-12T18:31:03.473 に答える