简体   繁体   English

如何修复损坏的 Ruby 配置

[英]How to fix a broken Ruby config

I use a MacOs High Sierra 10.13.6.我使用的是 MacOs High Sierra 10.13.6。 bundle install does not work anymore. bundle install不再起作用。 I had been using the bundler to run fastlane lanes for years on this machine.多年来,我一直在使用捆绑器在这台机器上运行 fastlane 通道。 I recently installed other sofware and I guess I made a mistake and broke the configuration.我最近安装了其他软件,我想我犯了一个错误并破坏了配置。

I have the following Gemfile:我有以下 Gemfile:

source " https://rubygems.org "来源“ https://rubygems.org

gem 'fastlane', '2.120.0'
gem 'aws-sdk', '2.10.8'
gem 'awscli', '0.2.8'
gem 'rake', '12.0.0'
gem 'danger', '5.4.3'

plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile')
eval(File.read(plugins_path), binding) if File.exist?(plugins_path)

When I try to run bundle install I get the error:当我尝试运行bundle install出现错误:

ERROR: cannot discover where libxml2 is located on your system.错误:无法发现 libxml2 在您的系统上的位置。 please make sure pkg-config is installed.请确保安装了pkg-config

An error occurred while installing nokogiri (1.8.2), and Bundler cannot continue.安装 nokogiri (1.8.2) 时出错,Bundler 无法继续。 Make sure that gem install nokogiri -v '1.8.2' --source ' https://rubygems.org/ ' succeeds before bundling.在捆绑之前确保 gem install nokogiri -v '1.8.2' --source ' https://rubygems.org/ ' 成功。

if I run:如果我跑:

gem install nokogiri -v '1.8.2'

or或者

gem install nokogiri -v 1.8.2 -n /usr/local/bin -- --use-system-libraries

I get the error:我收到错误:

ERROR: While executing gem ... (Errno::EACCES) Permission denied @ rb_sysopen - /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.2/.autotest错误:执行 gem 时 ... (Errno::EACCES) 权限被拒绝 @ rb_sysopen - /Library/Ruby/Gems/2.3.0/gems/nokogiri-1.8.2/.autotest

I have tried to change the permission of the folder and run:我试图更改文件夹的权限并运行:

gem install pkg-config -n /usr/local/bin -- --use-system-libraries
gem install nakogiri -v 1.8.2 -n /usr/local/bin -- --use-system-libraries

As suggested by one of the error messages I have also run:正如我还运行的错误消息之一所建议的:

bundle config build.nokogiri --use-system-libraries

In this case these commands succeed but the bundle install still fails with the same error.在这种情况下,这些命令会成功,但bundle install仍然失败并出现相同的错误。

I installed rvm .我安装了rvm Then in the .zshrc file I appended:然后在我附加的.zshrc文件中:

[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"

Then I run:然后我运行:

rvm reinstall all --force

and now it is working.现在它正在工作。

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

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