简体   繁体   English

Rails ActiveSupport::JSON 导致非法指令错误

[英]Rails ActiveSupport::JSON causes Illegal Instruction error

I'm trying to encode something in my rails project into JSON, but it seems like any call to any JSON API in Rails causes WEBrick to throw a "Illegal Instruction" error.我正在尝试将我的rails项目中的某些内容编码为JSON,但似乎对任何JSON API in Rails的调用都会导致WEBrick抛出"Illegal Instruction"

My code was:我的代码是:

@nodes = Node.all
j = ActiveSupport::JSON
@json = j.encode(@nodes)

I don't understand why I get this error.我不明白为什么我会收到这个错误。 Can someone please help?有人可以帮忙吗?

Not sure if this is relevant, but I'm also using mysql2spatial adapter because my Node class contains a field with type GEOMETRY (mysql spatial extensions).不确定这是否相关,但我也在使用mysql2spatial适配器,因为我的Node class 包含一个GEOMETRY类型的字段(mysql 空间扩展)。

Thanks!谢谢!

The JSON gem requires compiled extensions, so it's possible that your version isn't compiled for the architecture or OS you're currently using. JSON gem 需要编译扩展,因此您的版本可能不是针对您当前使用的架构或操作系统编译的。 You may want to re-install it and see if that resolves the problem.您可能需要重新安装它,看看是否能解决问题。

Ruby itself rarely throws exceptions, but compiled extensions do this much more frequently, especially if compiled against a different set of system libraries. Ruby 本身很少抛出异常,但编译后的扩展会更频繁地抛出异常,尤其是针对一组不同的系统库编译时。

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

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