在我安裝好 Ruby on Rails 后,使用 rails new 命令新建一個項目,然后切換到項目下執行 rails server,出現如下錯誤:
- sam@linux-qo4p:~/front/ror|master?⇒ rails server
- Ignoring RedCloth-4.2.9 because its extensions are not built. Try: gem pristine RedCloth-4.2.9
- Ignoring posix-spawn-0.3.9 because its extensions are not built. Try: gem pristine posix-spawn-0.3.9
- Ignoring rdiscount-2.1.7.1 because its extensions are not built. Try: gem pristine rdiscount-2.1.7.1
- /usr/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load such file -- bundler/setup (LoadError)
- from /usr/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require' --Vevb.com
- from /home/sam/front/ror/config/boot.rb:4:in `<top (required)>'
- from bin/rails:3:in `require_relative'
- from bin/rails:3:in `<main>'
這似乎是我把 openSUSE 系統從 13.1 升級到 13.2 后才出現的錯誤,我的情況里,嘗試錯誤信息中的提示方法 gem pristine RedCloth 并不能消除以上錯誤.
最后的解決辦法是:gem pristine --all,切換到項目根目錄,bundle install,再次跑 rails server,可以正常啟動不報錯,此后,rails new 新建的項目也不再報錯.
新聞熱點
疑難解答