简体   繁体   English

运行'rails s'时出现分段错误

[英]Segmentation fault when running 'rails s'

After doing a bundle install, I run 'rails s' it runs into this error. 在进行捆绑安装后,我运行'rails s'会遇到此错误。

$ rails s

/Users/XXXX/.rvm/gems/ruby-1.8.7-p352@r3/gems/json-1.5.3/ext/json/ext/json/ext/parser.bundle: [BUG] Segmentation fault
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-darwin10.8.0]

Abort trap

Any help would be greatly appreciated. 任何帮助将不胜感激。 Thanks! 谢谢!

  1. rvm gemset empty rvm gemset为空
  2. rvm use ree@my-gemset rvm使用ree @ my-gemset
  3. gem install bundler gem install bundler
  4. bundle install 捆绑安装

This solved the issue for me. 这解决了我的问题。 Must be some extension got compiled against the wrong version of Ruby (in my case). 必须是针对错误版本的Ruby编译的一些扩展(在我的例子中)。 Hope it works for you! 希望这对你有用!

If you are not using RVM, I found this command to uninstall all gems: 如果您不使用RVM,我发现此命令可以卸载所有gem:

  1. 'gem list | '宝石清单| cut -d" " -f1 | cut -d“” - f1 | xargs gem uninstall -aIx' xargs gem uninstall -aIx'
  2. gem install bundler gem install bundler
  3. bundle install 捆绑安装

您也可以尝试使用bundle exec rails s

Your gemset is not compiled for the version of ruby you are using. 您的gemset未针对您正在使用的ruby版本进行编译。 I found this worked for me: 我发现这对我有用:

  1. rvm gemset empty rvm gemset为空
  2. rvm gemset create your_gem_set_name rvm gemset创建your_gem_set_name
  3. rvm use 1.8.7@your_gem_set_name --default rvm使用1.8.7@your_gem_set_name --default
  4. bundle install 捆绑安装

Pull out the json gem and see if things work. 拉出json宝石,看看是否有效。 If they don't then I'm lost. 如果他们没有,那么我就输了。 If they do work then you have to figure out why that gem won't work with your version of rails and your version of ruby. 如果它们确实有效,那么你必须弄清楚为什么这个gem不适用于你的rails版本和你的ruby版本。

If you look in Gemfile.lock you will see a "treeview" of gems, and the nested ones are ones that were pulled in by a dependency from the one they're nested under. 如果您查看Gemfile.lock,您将看到gems的“树视图”,嵌套的那些是由它们嵌套的依赖项所引入的。 See if you are using this json gem for something important or if it can go. 看看你是否正在使用这个json gem来获取重要的东西,或者它是否可以。

I had a very similar issue when I took my rails 3.0.9 and tried to deploy it on a host that only had 3.0.3 on it. 当我使用rails 3.0.9并试图将其部署在只有3.0.3的主机上时,我遇到了一个非常类似的问题。 It turned out that the json gem was for some 3.0.9 version of a rails gem...maybe ActiveSupport? 事实证明,json gem是针对某些3.0.9版本的rails gem ...也许是ActiveSupport? I can't remember that part. 我不记得那部分了。

Can you tell us what version of rails you're using? 你能告诉我们你使用的是什么版本的导轨吗?

The new version of Ruby 1.8.7 caused this issue. 新版本的Ruby 1.8.7导致了这个问题。 Had to downgrade back to one from the past. 不得不从过去降级回到一个。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM