質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.48%
Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

ビルド

ソースコードを単体で実行可能なソフトウェアへ変換する過程をビルド(build)と呼びます

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

Q&A

解決済

1回答

3102閲覧

CircleCIにてbuild時にエラーがでる

tomsuma

総合スコア38

Ruby

Rubyはプログラミング言語のひとつで、オープンソース、オブジェクト指向のプログラミング開発に対応しています。

ビルド

ソースコードを単体で実行可能なソフトウェアへ変換する過程をビルド(build)と呼びます

Circle CI

Circle CIは、クラウド上に簡単にCI環境を構築できるWebサービスです。GitHubと連携させ、CIしたいリポジトリーを選択しビルド・テストを行います。チャット等を利用して結果を確認することが可能です。

0グッド

2クリップ

投稿2020/09/10 10:40

編集2020/09/10 21:30

初期設定の状態でビルドをしたのですが、何故かエラーが出てしまいました。。

このようなエラー内容だったので、

Traceback (most recent call last): 2: from /usr/local/bin/bundle:23:in `<main>' 1: from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path' /usr/local/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/circleci/project/Gemfile.lock. (Gem::GemNotFoundException

gem install bundler:2.1.4
bundle update --bundler
やgemfile.lookの内容を書き換えたのでスがダメでした、、

イメージ説明

gemfile.look

config

1version: 2.1 2orbs: 3 ruby: circleci/ruby@0.1.2 4 5jobs: 6 build: 7 docker: 8 - image: circleci/ruby:2.6.3-stretch-node 9 executor: ruby/default 10 steps: 11 - checkout 12 - run: 13 name: Which bundler? 14 command: bundle -v 15 - ruby/bundle-install
Traceback (most recent call last): 2: from /usr/local/bin/bundle:23:in `<main>' 1: from /usr/local/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path' /usr/local/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': Could not find 'bundler' (2.1.4) required by your /home/circleci/project/Gemfile.lock. (Gem::GemNotFoundException) To update to the latest version installed on your system, run `bundle update --bundler`. To install the missing version, run `gem install bundler:2.1.4` Exited with code exit status 1 CircleCI received exit code 1
version: 2.1 orbs: ruby: circleci/ruby@0.1.2 jobs: build: docker: - image: circleci/ruby:2.6.3-stretch-node executor: ruby/default steps: - checkout - run: gem install bundler:2.1.4 - run: name: Which bundler? command: bundle -v - ruby/bundle-install

bundle

1#!/usr/bin/env ruby 2# frozen_string_literal: true 3 4# 5# This file was generated by Bundler. 6# 7# The application 'bundle' is installed as part of a gem, and 8# this file is here to facilitate running it. 9# 10 11require "rubygems" 12 13m = Module.new do 14 module_function 15 16 def invoked_as_script? 17 File.expand_path($0) == File.expand_path(__FILE__) 18 end 19 20 def env_var_version 21 ENV["BUNDLER_VERSION"] 22 end 23 24 def cli_arg_version 25 return unless invoked_as_script? # don't want to hijack other binstubs 26 return unless "update".start_with?(ARGV.first || " ") # must be running `bundle update` 27 bundler_version = nil 28 update_index = nil 29 ARGV.each_with_index do |a, i| 30 if update_index && update_index.succ == i && a =~ Gem::Version::ANCHORED_VERSION_PATTERN 31 bundler_version = a 32 end 33 next unless a =~ /\A--bundler(?:[= ](#{Gem::Version::VERSION_PATTERN}))?\z/ 34 bundler_version = $1 35 update_index = i 36 end 37 bundler_version 38 end 39 40 def gemfile 41 gemfile = ENV["BUNDLE_GEMFILE"] 42 return gemfile if gemfile && !gemfile.empty? 43 44 File.expand_path("../../Gemfile", __FILE__) 45 end 46 47 def lockfile 48 lockfile = 49 case File.basename(gemfile) 50 when "gems.rb" then gemfile.sub(/.rb$/, gemfile) 51 else "#{gemfile}.lock" 52 end 53 File.expand_path(lockfile) 54 end 55 56 def lockfile_version 57 return unless File.file?(lockfile) 58 lockfile_contents = File.read(lockfile) 59 return unless lockfile_contents =~ /\n\nBUNDLED WITH\n\s{2,}(#{Gem::Version::VERSION_PATTERN})\n/ 60 Regexp.last_match(1) 61 end 62 63 def bundler_version 64 @bundler_version ||= 65 env_var_version || cli_arg_version || 66 lockfile_version 67 end 68 69 def bundler_requirement 70 return "#{Gem::Requirement.default}.a" unless bundler_version 71 72 bundler_gem_version = Gem::Version.new(bundler_version) 73 74 requirement = bundler_gem_version.approximate_recommendation 75 76 return requirement unless Gem::Version.new(Gem::VERSION) < Gem::Version.new("2.7.0") 77 78 requirement += ".a" if bundler_gem_version.prerelease? 79 80 requirement 81 end 82 83 def load_bundler! 84 ENV["BUNDLE_GEMFILE"] ||= gemfile 85 86 activate_bundler 87 end 88 89 def activate_bundler 90 gem_error = activation_error_handling do 91 gem "bundler", bundler_requirement 92 end 93 return if gem_error.nil? 94 require_error = activation_error_handling do 95 require "bundler/version" 96 end 97 return if require_error.nil? && Gem::Requirement.new(bundler_requirement).satisfied_by?(Gem::Version.new(Bundler::VERSION)) 98 warn "Activating bundler (#{bundler_requirement}) failed:\n#{gem_error.message}\n\nTo install the version of bundler this project requires, run `gem install bundler -v '#{bundler_requirement}'`" 99 exit 42 100 end 101 102 def activation_error_handling 103 yield 104 nil 105 rescue StandardError, LoadError => e 106 e 107 end 108end 109 110m.load_bundler! 111 112if m.invoked_as_script? 113 load Gem.bin_path("bundler", "bundle") 114end 115
ターミナル bundle install Your Ruby version is 2.6.5, but your Gemfile specified 2.6.3

CircleCI

1#!/bin/bash -eo pipefail 2bundle install --path vendor/bundle 3[DEPRECATED] The `--path` flag is deprecated because it relies on being remembered across bundler invocations, which bundler will no longer do in future versions. Instead please use `bundle config set path 'vendor/bundle'`, and stop using this flag 4Your Ruby version is 2.6.3, but your Gemfile specified 2.6.5 5 6Exited with code exit status 18 7CircleCI received exit code 18

最初のビルド時に渡される内容をそのままコピーしました

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

回答1

0

ベストアンサー

Which bundler?の前にgem install bundler:2.1.4を追加

- checkout - run: gem install bundler:2.1.4 - run: name: Which bundler? command: bundle -v

これでbundleがinstallされると思います。

投稿2020/09/10 10:51

necocoa

総合スコア209

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

tomsuma

2020/09/10 11:33

ご回答ありがとうございます! 変更してgit push したのですがやはり同じエラーが出てしまい bundle -v でバージョンを確認してみたものの Parsing documentation for bundler-2.1.4 とでてきたので大丈夫なはずなのですがどこがおかしいのでしょうか、、
necocoa

2020/09/10 11:46

Gemfile.lockファイルにある下記の部分は何になってますか? BUNDLED WITH 2.1.4
tomsuma

2020/09/10 11:47

BUNDLED WITH 2.1.4 でした
necocoa

2020/09/10 13:22

わかったかもしれないです rubyのversionなんですか? Gemfile.lock下部のここですね RUBY VERSION ruby 2.7.1p83
tomsuma

2020/09/10 21:31

そうですね! たしかになかったので、 追加したのですが、 ターミナルではバージョン2.6.5 CircleCIでは2.6.3を求められ困ってます
tomsuma

2020/09/11 00:42

docker-compose では web_1 | Your Ruby version is 2.6.6, but your Gemfile specified 2.6.5 と出ます
necocoa

2020/09/11 00:45

circleciのconfigのdocker imageを circleci/ruby:2.6.3-stretch-node ↓ circleci/ruby:2.6.5-stretch-node に変えてみてください
tomsuma

2020/09/11 00:56

できました! ありがとうございます
guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.48%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問