2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Rails bundle install errrrrrrrror

Posted at

Gemfileに以下を入れて

gem "refile", require: "refile/rails", github: 'manfe/refile'
gem "refile-mini_magick"

以下のコマンドを打つと、、、、

docker-compose run web rails g model PostImage shop_name:text image_id:string caption:text user_id:integer

エラー

/usr/local/bundle/gems/bundler-2.2.15/lib/bundler/source/git/git_proxy.rb:223:in 
`allowed_with_path': The git source https://github.com/manfe/refile.git is not yet checked out. Please run
 `bundle install` before trying to start your application (Bundler::GitError)
ERROR: 1

⇨bundle installをしろ〜と怒られた〜。。

試したこと

以下のコマンドを実行。

docker-compose build

⇨docker-compose buildでGemfileが更新がする=bundle installと最初思っていたので、それ自体が間違いであった。

Dockerfile

FROM ruby:2.7

RUN curl https://deb.nodesource.com/setup_12.x | bash
RUN curl https://dl.yarnpkg.com/debian/pubkey.gpg | apt-key add -
RUN echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list

RUN apt-get update && apt-get install -y nodejs yarn postgresql-client

WORKDIR /app
COPY ./src /app
RUN gem install bundler

RUN bundle config --local set path 'vendor/bundle'
RUN bundle install

解決方法

docker-compose run web bundle install

⇨普通にやってみた。以下の通り成功した。

Bundle complete! 21 Gemfile dependencies, 99 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.

そして、

docker-compose run web rails g model PostImage shop_name:text image_id:string caption:text user_id:integer

成功!!

Creating rails-meshitero_web_run ... done
Running via Spring preloader in process 19
      invoke  active_record
      create    db/migrate/20210319223106_create_post_images.rb
      create    app/models/post_image.rb
      invoke    test_unit
      create      test/models/post_image_test.rb
      create      test/fixtures/post_images.yml

勉強になりました。
頭が回っている朝のうちにエラー解消はすべきですな。

ありがとうございました。

2
0
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?