2
2

More than 3 years have passed since last update.

rails newするとCould not load command "rails/commands/server/server_command". Error: uninitialized constant URI::Generic.と表示される時の対処法

Posted at
Vagrantを使って環境構築をしている際、エラーに遭遇したので記録を残しておきます。

構築環境

Ruby 2.5.0
Ruby on rails 5.1.7
Vagrant 2.2.7
Virtual Box 6.1.4
rbenv 1.1.2

発生したエラー

$ rails new
#省略
[WARNING] Could not load command "rails/commands/server/server_command". Error:
uninitialized constant URI::Generic.

解決した方法

Rubyのバージョンを2.5.7に上げるとこのエラーは解消されました。

#バージョン2.5.7のRubyをインストール
$ rbenv install 2.5.7
#省略

#使用する全体のrubyのバージョンを指定
$rbenv global 2.5.7

#Rubyのバージョンを確認
$ruby -v
ruby 2.5.7p206 (2019-10-01 revision 67816) [x86_64-linux]

$rails new
#うまくいきました

https://stackoverflow.com/questions/59961343/failing-to-start-up-default-rails-server
この質問を参考にしてバージョンを変えてみたんですが、よく読むと2.5.7でも同じ現象が起こったって書かれてますね...。原因が分かる方は教えていただきたいです。

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