LoginSignup
7
5

More than 5 years have passed since last update.

warning: already initialized constant Bootstrap::VERSION

Posted at

最近Railsを初めて現在色々とお試し中ですが、Bootstrapを入れてみた時になんかずっとwarningが出て気になったのでその対処法を収めて見ました。

実行環境

  • Mac OS High Sierra 10.13.4
  • Rails 5.1.5

本記事で用いている用語

  • user_name:自分のPCの名前
  • directory:中間の階層

warning: already initialized constant Bootstrap::VERSION

ずっとで続けてても特に問題なく動いていたのですが、さすがに気になっていたので今回はwarningを処理していきたいと思います。

bash
$ rails s
/Users/user_name/directory/vender/bundle/ruby/2.5.0/gems/bootstrap-sass-3.3.7/lib/bootstrap-sass/version.rb:2: warning: already initialized constant Bootstrap::VERSION
/Users/user_name/directory/vender/bundle/ruby/2.5.0/gems/bootstrap-4.0.0/lib/bootstrap/version.rb:2: warning: previous definition of VERSION was here
/Users/user_name/directory/vender/bundle/ruby/2.5.0/gems/bootstrap-sass-3.3.7/lib/bootstrap-sass/version.rb:3: warning: already initialized constant Bootstrap::BOOTSTRAP_SHA
/Users/user_name/directory/vender/bundle/ruby/2.5.0/gems/bootstrap-4.0.0/lib/bootstrap/version.rb:3: warning: previous definition of BOOTSTRAP_SHA was here
=> Booting Puma
=> Rails 5.1.5 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.11.3 (ruby 2.5.0-p0), codename: Love Song
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

解決策

中国のサイトのようで、中国語は読めないので翻訳に頼りきっていますがとても参考になったので気になる方は見てみるといいかもしれないですね!
- warning: already initialized constant Bootstrap::VERSION

Bootstrapを使いたかったのとsassを使いたかったので、それぞれのライブラリをGemfileに書き込んでいました。

Gemfile
gem 'bootstrap'
gem 'bootstrap-sass'

ですが下のgem 'bootstrap-sass'だけでいいようなのでgem 'bootstrap'をコメントアウトして実行してみました。

Gemfile
# gem 'bootstrap'
gem 'bootstrap-sass'
bash
$ rails s
=> Booting Puma
=> Rails 5.1.5 application starting in development
=> Run `rails server -h` for more startup options
Puma starting in single mode...
* Version 3.11.3 (ruby 2.5.0-p0), codename: Love Song
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://0.0.0.0:3000
Use Ctrl-C to stop

ちゃんとwarningが消えました!!
お疲れ様でした!!\\\٩( 'ω' )و ////

ちょっとした雑談

今回はちょっとしたwarningの解消だったので、短めの記事になりましたね( ´ ▽ ` )
これからも少しずつ自分の勉強ログを残していけたらなと思います!

参考にした記事

warning: already initialized constant Bootstrap::VERSION

7
5
0

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
7
5