在我安装好 Ruby on Rails 后,使用 rails new 命令新建一个项目,然后切换到项目下执行 rails server,出现如下错误:
- sam@linux-qo4p:~/front/ror|master?⇒railsserver
- IgnoringRedCloth-4.2.9becauseitsextensionsarenotbuilt.Try:gempristineRedCloth-4.2.9
- Ignoringposix-spawn-0.3.9becauseitsextensionsarenotbuilt.Try:gempristineposix-spawn-0.3.9
- Ignoringrdiscount-2.1.7.1becauseitsextensionsarenotbuilt.Try:gempristinerdiscount-2.1.7.1
- /usr/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in`require':cannotloadsuchfile--bundler/setup(LoadError)
- from/usr/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in`require'--phpfensi.com
- from/home/sam/front/ror/config/boot.rb:4:in`<top(required)>'
- frombin/rails:3:in`require_relative'
- frombin/rails:3:in`<main>'
这似乎是我把 openSUSE 系统从 13.1 升级到 13.2 后才出现的错误,我的情况里,尝试错误信息中的提示方法 gem pristine RedCloth 并不能消除以上错误.
最后的解决办法是:gem pristine --all,切换到项目根目录,bundle install,再次跑 rails server,可以正常启动不报错,此后,rails new 新建的项目也不再报错.