在我安装好 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'  --phpfensi.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 新建的项目也不再报错.

dawei

【声明】:站长网内容转载自互联网,其相关言论仅代表作者个人观点绝非权威,不代表本站立场。如您发现内容存在版权问题,请提交相关链接至邮箱:bqsm@foxmail.com,我们将及时予以处理。