エラー
rails new でAPPを作成後、rails s
で躓いた.
$ rails s
bin/rails:6: warning: already initialized constant APP_PATH
/home/dev1/railbook/bin/rails:6: warning: previous definition of APP_PATH was here
環境
$ ruby -v
ruby 2.2.0p0 (2014-12-25 revision 49005) [x86_64-linux]
$ rails -v
Rails 4.2.0
解決
rake rails:update:bin を実行してみる.
$ rake rails:update:bin
(in /home/dev1/railbook)
rake aborted!
LoadError: cannot load such file -- readline
/home/dev1/railbook/config/application.rb:7:in `<top (required)>'
/home/dev1/railbook/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
更にエラーが出た. Gemfileに以下の1行を追加する.
gem 'rb-readline'
bundle installする.
$ bundle install
再度rails s
を実行してみる
$ rails s
=> Booting WEBrick
=> Rails 4.2.0 application starting in development on http://localhost:3000
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-02-14 02:17:26] INFO WEBrick 1.3.1
[2015-02-14 02:17:26] INFO ruby 2.2.0 (2014-12-25) [x86_64-linux]
[2015-02-14 02:17:26] INFO WEBrick::HTTPServer#start: pid=1278 port=3000
ok. WEBrickが起動できた.
Ruby on Rails 4 アプリケーションプログラミング
- 作者: 山田祥寛
- 出版社/メーカー: 技術評論社
- 発売日: 2014/04/11
- メディア: 大型本
- この商品を含むブログ (6件) を見る