简体   繁体   English

导轨中止! 运行“rails new”和“rails s”时,nokogiri 和 dlopen 出现加载错误

[英]rails aborted! when running `rails new` and `rails s` giving load error for nokogiri and dlopen

I am on macOS and tried starting a new rails app with rails new MyBlog -T --database:postgresql and I am getting the following error dialog (the same happens for rails s :我在 macOS 上并尝试使用rails new MyBlog -T --database:postgresql启动一个新的 rails 应用程序,我收到以下错误对话框( rails s也会发生同样的情况:

LoadError: cannot load such file -- nokogiri/nokogiri
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:89:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:44:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri/extension.rb:25:in `rescue in <main>'
/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri/extension.rb:4:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri.rb:11:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/actiontext-6.1.3/lib/action_text.rb:6:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/actiontext-6.1.3/lib/action_text/engine.rb:8:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Users/me/CodeProjects/MyBlog/config/application.rb:12:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
/Users/me/CodeProjects/MyBlog/Rakefile:4:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/command.rb:52:in `invoke'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/commands.rb:18:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/me/CodeProjects/MyBlog/bin/rails:5:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/me/CodeProjects/MyBlog/bin/spring:10:in `block in <top (required)>'
/Users/me/CodeProjects/MyBlog/bin/spring:7:in `tap'
/Users/me/CodeProjects/MyBlog/bin/spring:7:in `<top (required)>'
bin/rails:2:in `load'
bin/rails:2:in `<main>'

Caused by:
LoadError: dlopen(/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle, 0x0009): could not use '/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle' because it is not a compatible arch - /Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri/2.6/nokogiri.bundle
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri/extension.rb:6:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/nokogiri-1.11.2-arm64-darwin/lib/nokogiri.rb:11:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/actiontext-6.1.3/lib/action_text.rb:6:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Library/Ruby/Gems/2.6.0/gems/actiontext-6.1.3/lib/action_text/engine.rb:8:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `block in require'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:299:in `load_dependency'
/Library/Ruby/Gems/2.6.0/gems/activesupport-6.1.3/lib/active_support/dependencies.rb:332:in `require'
/Users/me/CodeProjects/MyBlog/config/application.rb:12:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:53:in `require_relative'
/Users/me/CodeProjects/MyBlog/Rakefile:4:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:59:in `load'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/commands/rake/rake_command.rb:20:in `block in perform'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/commands/rake/rake_command.rb:18:in `perform'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/command.rb:52:in `invoke'
/Library/Ruby/Gems/2.6.0/gems/railties-6.1.3/lib/rails/commands.rb:18:in `<main>'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `require'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:23:in `block in require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/loaded_features_index.rb:92:in `register'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:22:in `require_with_bootsnap_lfi'
/Library/Ruby/Gems/2.6.0/gems/bootsnap-1.7.2/lib/bootsnap/load_path_cache/core_ext/kernel_require.rb:31:in `require'
/Users/me/CodeProjects/MyBlog/bin/rails:5:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `load'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/rails.rb:28:in `call'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client/command.rb:7:in `call'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/client.rb:30:in `run'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/bin/spring:49:in `<top (required)>'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `load'
/Library/Ruby/Gems/2.6.0/gems/spring-2.1.1/lib/spring/binstub.rb:11:in `<top (required)>'
/Users/me/CodeProjects/MyBlog/bin/spring:10:in `block in <top (required)>'
/Users/me/CodeProjects/MyBlog/bin/spring:7:in `tap'
/Users/me/CodeProjects/MyBlog/bin/spring:7:in `<top (required)>'
bin/rails:2:in `load'
bin/rails:2:in `<main>'

I tried bundle update and bundle install , without anything changing.我尝试了bundle updatebundle install ,没有任何改变。

When I try gem uninstall nokogiri I get当我尝试gem uninstall nokogiri我得到

gem uninstall nokogiri

Select gem to uninstall:
 1. nokogiri-1.11.2-arm64-darwin
 2. nokogiri-1.11.2-x86_64-darwin
 3. All versions
>

und with 3 I run into和 3 我遇到

ERROR:  While executing gem ... (Gem::FilePermissionError)
    You don't have write permissions for the /Library/Ruby/Gems/2.6.0 directory.

can anyone help me out please?谁能帮帮我?

The permission error probably means the gem has been installed by user root, doing something like sudo gem install , which means you have to use sudo to remove it too.权限错误可能意味着 gem 已由用户 root 安装,执行类似sudo gem install的操作,这意味着您也必须使用sudo将其删除。

Now the nokogiri gem usually relies upon what is called native extensions, ie code that has to be compiled for a specific kind of platform.现在 nokogiri gem 通常依赖于所谓的本地扩展,即必须为特定类型的平台编译的代码。

Here we can see you have nokogiri installed for both x86_64-darwin and arm64-darwin.在这里我们可以看到您已经为 x86_64-darwin 和 arm64-darwin 安装了 nokogiri。

Here darwin refers to your operating system (mac OS)这里darwin指的是你的操作系统(mac OS)

x86_64 is the code named for the 64bit versions of the intel family of processor, something also called amd64 because the first such processor was developed by AMD. x86_64是为英特尔系列处理器的 64 位版本命名的代码,也称为amd64 ,因为第一个此类处理器是由 AMD 开发的。

arm64 is another computer architecture, based on ARM which is often use in mobile phones and tablets because of it's lower energy consumption. arm64是另一种计算机架构,基于ARM,由于能耗较低,因此经常用于手机和平板电脑。

arm64-darwin refers to the new Apple Silicon architecture. arm64-darwin指的是新的 Apple Silicon 架构。

Now dlopen is the C api to load a shared-library (.so), and it reports clearly:现在dlopen是 C api 加载共享库(.so),它清楚地报告:

 could not use '.../nokogiri-1.11.2-arm64-darwin/l...' because it is not a compatible arch

So you know it's not usable on your system.所以你知道它在你的系统上不可用。 which means you can probably safely remove it.这意味着您可能可以安全地删除它。

Additionaly, you could try using asdf , rbenv , rvm or something similar to manage your ruby versions, which will also keep your gems (depending on how you configure it) in your User's folder so you don't need to worry about sudo .另外,您可以尝试使用asdfrbenvrvm或类似的东西来管理您的 ruby 版本,这也会将您的宝石(取决于您如何配置它)保存在您的用户文件夹中,因此您不必担心sudo

I was just having the same issue on my local environment (MAC OS Catalina 10.15.7, ruby 2.6.3p62, Rails 6.1.3) and I was able to resolve it by doing the following.我只是在我的本地环境(MAC OS Catalina 10.15.7、ruby 2.6.3p62、Rails 6.1.3)上遇到了同样的问题,我能够通过执行以下操作来解决它。

# Remove all versions of the nokogiri gem
sudo gem uninstall nokogiri
brew install libxml2
gem install nokogiri -- --use-system-libraries \
--with-xml2-include=$(brew --prefix libxml2)/include/libxml2

Then remove the nokogiri (1.11.2-arm64-darwin) dependency from your Gemfile.lock.然后从 Gemfile.lock 中删除 nokogiri (1.11.2-arm64-darwin) 依赖项。

nokogiri (1.11.2-arm64-darwin)
  racc (~> 1.4)

The idea of installing libxml2 via brew and using it for the nokogiri gem I got it from here: https://nokogiri.org/tutorials/installing_nokogiri.html#macos-error-use-of-undeclared-identifier-lzma_ok (solution 2)通过brew安装libxml2并将其用于nokogiri gem的想法我从这里得到它: https://nokogiri.org/tutorials/installing_nokogiri.html#macos-error-use-of-undeclared-identifier-lzma_ok (解决方案2 )

Hope it helps!希望能帮助到你! Happy rails coding!快乐的 Rails 编码!


Update You may not need to uninstall nokogiri and install libxml2.更新您可能不需要卸载 nokogiri 并安装 libxml2。 By simply removing nokogiri (1.11.2-arm64-darwin) from your Gemfile.lock may solve the issue只需从 Gemfile.lock 中删除nokogiri (1.11.2-arm64-darwin)即可解决问题

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

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