LoginSignup
0
0

More than 1 year has passed since last update.

railsチュートリアル rails serverでエラー Blocked host:〜

Last updated at Posted at 2022-01-04

railsチュートリアルの1.3.2rails serverのところで一瞬詰まったのでメモ

まずこの1.3.2ではrails serverというコマンドを実行するだけでRailsアプリを実行できるよーというお話。

コマンドを実行する前にローカルWebサーバーへの接続を許可する必要があるので
config/environments/development.rb
のconfig.file_watcherの下の行に

config.hosts.clear

を追加

別ターミナルを開いてrails serverを実行しプレビューで確認すると
Blocked host:〜
というプレビュー画面が表示されてしまった。

解決方法

ターミナルの画面で

$ rails server
Could not find gem 'puma (= 4.3.6)' in rubygems repository https://rubygems.org/ or installed locally.
The source contains the following versions of 'puma': 4.3.10
Run `bundle install` to install missing gems.

と出ているので
bundleをインストール

$ bundle install

すると

Fetching gem metadata from https://rubygems.org/...........
You have requested:
  listen = 3.1.5

The bundle currently has listen locked at 3.7.0.
Try running `bundle update listen`

If you are updating multiple gems in your Gemfile at once,
try passing them all to `bundle update`

と出てくる
1.3.1ではではbundleをインストールしたときに問題がなかったが今回ここでアップデートが必要と出てきたので指示に従ってそのままアップデートを実行

$ bundle update

あらためてrails server

$ rails server

2022-01-05 2.40.09.png

無事にデフォルトのrailsの画面を表示できました!

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