僕の世界観を変えてみる

文系男子が趣味でプログラミングを勉強していくブログです。他にも日常で起きたどうでもいいことや愚痴を書いていきたいです。座右の銘は和を以て貴しとなすです。仲良くやろうよ。

cloud9でrailsサーバを立ち上げる、の巻

$ rails s -b 0.0.0.0

cloud9ではipを0.0.0.0に指定する

f:id:htmllifehack:20200726123627p:plain

Specified 'sqlite3' for database adapter, but the gem is not loaded. Add gem 'sqlite3' to your Gemfile (and ensure its version is at the minimum req

sqlite3のバージョンを指定する必要がある。

rails newで作成したディレクトリ内にあるGemfileを編集する

$ vim Gemfile

>>
source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.0.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '~>1.3.6'

もう一度サーバを起動させてみる。

$ rails s -b 0.0.0.0

>>
Could not find gem 'sqlite3 (~> 1.3.6)' in any of the gem sources listed in your Gemfile.
Run `bundle install` to install missing gems.

bundle installするように言われているのでやってみる。

$ bundle install

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

一応updateもしておく。

$ bundle update

>>
Bundle updated!

再度サーバを起動。

$ rails s -b 0.0.0.0

f:id:htmllifehack:20200726124756p:plain

成功