前提・実現したいこと
Ruby/railsの環境構築をしたい。(Macbook)
一度環境構築は成功していますが、2.7.2から2.6.6に変更しようとしたが、戻らず、再び2.7.2に変更使用としたところ、今回のエラーが発生しました。
Ruby2.7.2のインストールは以下の手順で完了しております。
1.Homebrewをインストール。
2.rbenvをインストール.
%brew install rbenv ruby-build
3.ruby2.7.2のインストール
rbenv install 2.7.2
4.パスを通す
%echo $SHELL /bin/zsh %echo 'eval "$(rbenv init -)"' >> ~/.zshrc %source ~/.zshrc
5.バージョン指定
%rbenv global 2.7.2 %rbenv versions system * 2.7.2 (set by /Users/masakiyousuke/.ruby-version)
6.パスの確認
%which ruby /Users/masakiyousuke/.rbenv/shims/ruby
7.railsのインストールをすると以下のエラーが表示されます。
%gem install rails /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/version.rb:157: warning: already initialized constant Gem::Version::VERSION_PATTERN /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/version.rb:158: warning: previous definition of VERSION_PATTERN was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/version.rb:158: warning: already initialized constant Gem::Version::ANCHORED_VERSION_PATTERN /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/version.rb:159: warning: previous definition of ANCHORED_VERSION_PATTERN was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:12: warning: already initialized constant Gem::Requirement::OPS /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/requirement.rb:14: warning: previous definition of OPS was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:22: warning: already initialized constant Gem::Requirement::SOURCE_SET_REQUIREMENT /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/requirement.rb:24: warning: previous definition of SOURCE_SET_REQUIREMENT was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:25: warning: already initialized constant Gem::Requirement::PATTERN_RAW /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/requirement.rb:27: warning: previous definition of PATTERN_RAW was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:30: warning: already initialized constant Gem::Requirement::PATTERN /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/requirement.rb:32: warning: previous definition of PATTERN was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:35: warning: already initialized constant Gem::Requirement::DefaultRequirement /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/requirement.rb:37: warning: previous definition of DefaultRequirement was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:40: warning: already initialized constant Gem::Requirement::DefaultPrereleaseRequirement /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/requirement.rb:42: warning: previous definition of DefaultPrereleaseRequirement was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/requirement.rb:311: warning: already initialized constant Gem::Version::Requirement /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/platform.rb:204: warning: already initialized constant Gem::Platform::RUBY /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/platform.rb:198: warning: previous definition of RUBY was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/platform.rb:210: warning: already initialized constant Gem::Platform::CURRENT /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/platform.rb:204: warning: previous definition of CURRENT was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:47: warning: already initialized constant Gem::Specification::NONEXISTENT_SPECIFICATION_VERSION /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:51: warning: previous definition of NONEXISTENT_SPECIFICATION_VERSION was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:70: warning: already initialized constant Gem::Specification::CURRENT_SPECIFICATION_VERSION /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:74: warning: previous definition of CURRENT_SPECIFICATION_VERSION was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:76: warning: already initialized constant Gem::Specification::SPECIFICATION_VERSION_HISTORY /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:80: warning: previous definition of SPECIFICATION_VERSION_HISTORY was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:94: warning: already initialized constant Gem::Specification::MARSHAL_FIELDS /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:98: warning: previous definition of MARSHAL_FIELDS was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:103: warning: already initialized constant Gem::Specification::TODAY /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:107: warning: previous definition of TODAY was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:106: warning: already initialized constant Gem::Specification::LOAD_CACHE /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:110: warning: previous definition of LOAD_CACHE was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:108: warning: already initialized constant Gem::Specification::LOAD_CACHE_MUTEX /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:112: warning: previous definition of LOAD_CACHE_MUTEX was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:112: warning: already initialized constant Gem::Specification::VALID_NAME_PATTERN /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:116: warning: previous definition of VALID_NAME_PATTERN was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:163: warning: already initialized constant Gem::Specification::INITIALIZE_CODE_FOR_DEFAULTS /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:167: warning: previous definition of INITIALIZE_CODE_FOR_DEFAULTS was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:189: warning: already initialized constant Gem::Specification::NOT_FOUND /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:192: warning: previous definition of NOT_FOUND was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:194: warning: already initialized constant Gem::Specification::REMOVED_METHODS /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:197: warning: previous definition of REMOVED_METHODS was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1668: warning: already initialized constant Gem::Specification::DateLike /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:1671: warning: previous definition of DateLike was here /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/specification.rb:1673: warning: already initialized constant Gem::Specification::DateTimeFormat /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/specification.rb:1676: warning: previous definition of DateTimeFormat was here Traceback (most recent call last): 5: from <internal:gem_prelude>:1:in `<internal:gem_prelude>' 4: from <internal:gem_prelude>:1:in `require' 3: from /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems.rb:1441:in `<top (required)>' 2: from /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems.rb:1441:in `require' 1: from /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:10:in `<top (required)>' /Users/masakiyousuke/.rbenv/versions/2.7.2/lib/ruby/site_ruby/2.7.0/rubygems/core_ext/kernel_require.rb:20:in `<module:Kernel>': uninitialized constant Gem::KERNEL_WARN_IGNORES_INTERNAL_ENTRIES (NameError)
8.また、railsのバージョンを確認すると以下のメッセージが表示され、sudo〜を実行すると上記のエラーと同じメッセージが表示されます。
%rails -v Rails is not currently installed on this system. To get the latest version, simply type: $ sudo gem install rails You can then rerun your "rails" command.
試したこと
バージョン2.6.6への変更を行いましたが同じエラーになります。
補足情報(FW/ツールのバージョンなど)
nodeとyarnのインストールは完了しています。
よろしくお願い致します。
あなたの回答
tips
プレビュー