Rails 控制台不工作 "You may have encountered a bug"
Rails console doesn't work "You may have encountered a bug"
我搜索了这个问题是否已经被问过,但我没有找到任何东西。我已经使用 ruby 2.3.0 版和 rails 5.0.0.1 版创建了一个应用程序,
当我运行这个命令
rails console
然后我尝试像那样访问数据库:
Post.all
User.all
或其他命令行我有这个巨大的错误(抱歉所有这些行:
/Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:27: [BUG] Segmentation fault at 0x00000000000110
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0061 p:---- s:0252 e:000251 CFUNC :initialize
c:0060 p:---- s:0250 e:000249 CFUNC :new
c:0059 p:0186 s:0245 e:000244 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:
c:0058 p:0028 s:0238 e:000237 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0057 p:0027 s:0235 e:000234 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0056 p:0025 s:0232 e:000231 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0055 p:0018 s:0227 e:000226 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0054 p:0016 s:0222 e:000220 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0053 p:0035 s:0217 e:000213 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0052 p:0046 s:0211 e:000210 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0051 p:0015 s:0205 e:000204 METHOD
.......(其他行)
1666 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder/range_handler.rb
1667 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder/relation_handler.rb
1668 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder.rb
1669 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/table_metadata.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
没错,编辑 Gemfile 放入
gem 'sqlite3'
到
group :development, :test do
gem 'sqlite3'
end
和
rails console
会为我所用!谢谢!
像这样试试对我有用
gem uninstall sqlite3
gem install sqlite3
在rails c
之前输入spring stop
或者只删除 Gemfile 中的 gem spring
。
试试吧!
在这里您可以找到更多相关信息:
如果您仍然运行遇到问题,请尝试以下步骤:
通过运行使用 npm 安装 webpacker 命令:npm i
@rails/webpacker
运行 捆绑安装
注意:您可能需要删除版本名称。如果是这样,请执行以下操作:
在您的 Gemfile 中:将带有 webpacker gem 的行更改为:gem
网络打包机
Delete the gemfile.lock file
Run bundle install
手动添加一个名为webpacker.yml的文件到config目录
(最终路径:./config/webpacker.yml).
Add this text to the webpacker.yml file:
发展:
dev_server:
主机:本地主机
端口:3000
如果您使用的是芯片M1
sudo arch -x86_64 gem install ffi
然后
arch -x86_64 pod install
我搜索了这个问题是否已经被问过,但我没有找到任何东西。我已经使用 ruby 2.3.0 版和 rails 5.0.0.1 版创建了一个应用程序,
当我运行这个命令
rails console
然后我尝试像那样访问数据库:
Post.all
User.all
或其他命令行我有这个巨大的错误(抱歉所有这些行:
/Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:27: [BUG] Segmentation fault at 0x00000000000110
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
-- Crash Report log information --------------------------------------------
See Crash Report log file under the one of following:
* ~/Library/Logs/CrashReporter
* /Library/Logs/CrashReporter
* ~/Library/Logs/DiagnosticReports
* /Library/Logs/DiagnosticReports
for more details.
Don't forget to include the above Crash Report log file in bug reports.
-- Control frame information -----------------------------------------------
c:0061 p:---- s:0252 e:000251 CFUNC :initialize
c:0060 p:---- s:0250 e:000249 CFUNC :new
c:0059 p:0186 s:0245 e:000244 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/sqlite3_adapter.rb:
c:0058 p:0028 s:0238 e:000237 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0057 p:0027 s:0235 e:000234 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0056 p:0025 s:0232 e:000231 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0055 p:0018 s:0227 e:000226 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0054 p:0016 s:0222 e:000220 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0053 p:0035 s:0217 e:000213 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0052 p:0046 s:0211 e:000210 METHOD /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/connection_adapters/abstract/connection
c:0051 p:0015 s:0205 e:000204 METHOD
.......(其他行)
1666 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder/range_handler.rb
1667 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder/relation_handler.rb
1668 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/relation/predicate_builder.rb
1669 /Users/marchardantonin/.rvm/gems/ruby-2.3.0/gems/activerecord-5.0.0.1/lib/active_record/table_metadata.rb
[NOTE]
You may have encountered a bug in the Ruby interpreter or extension libraries.
Bug reports are welcome.
For details: http://www.ruby-lang.org/bugreport.html
没错,编辑 Gemfile 放入
gem 'sqlite3'
到
group :development, :test do
gem 'sqlite3'
end
和
rails console
会为我所用!谢谢!
像这样试试对我有用
gem uninstall sqlite3
gem install sqlite3
在rails c
spring stop
或者只删除 Gemfile 中的 gem spring
。
试试吧!
在这里您可以找到更多相关信息:
如果您仍然运行遇到问题,请尝试以下步骤:
通过运行使用 npm 安装 webpacker 命令:npm i @rails/webpacker 运行 捆绑安装 注意:您可能需要删除版本名称。如果是这样,请执行以下操作:
在您的 Gemfile 中:将带有 webpacker gem 的行更改为:gem 网络打包机
Delete the gemfile.lock file Run bundle install
手动添加一个名为webpacker.yml的文件到config目录 (最终路径:./config/webpacker.yml).
Add this text to the webpacker.yml file:
发展: dev_server: 主机:本地主机 端口:3000
如果您使用的是芯片M1
sudo arch -x86_64 gem install ffi
然后
arch -x86_64 pod install