Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/macos/9.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby 在osx 10.9上安装捆绑包失败_Ruby_Macos_Gem_Rubygems - Fatal编程技术网

Ruby 在osx 10.9上安装捆绑包失败

Ruby 在osx 10.9上安装捆绑包失败,ruby,macos,gem,rubygems,Ruby,Macos,Gem,Rubygems,我和rvm在OSX Marvericks上。 从bundler安装像nokogiri这样的本机扩展失败。 但从gem命令安装是可行的 我还安装了最新的XCode命令行工具 我不知道bundle安装和gem安装有什么区别 $ rvm requirements Checking requirements for osx. Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date. Requirements ins

我和rvm在OSX Marvericks上。 从bundler安装像nokogiri这样的本机扩展失败。 但从gem命令安装是可行的

我还安装了最新的XCode命令行工具

我不知道bundle安装和gem安装有什么区别

$ rvm requirements Checking requirements for osx. Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date. Requirements installation successful. Yusuke-no-MacBook-Air-2:doorkeeper-jp-admin yandod$ bundle install Fetching gem metadata from https://rubygems.org/......... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using rake 10.3.1 Using bundler 1.6.2 Using mini_portile 0.5.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /Users/yandod/.rvm/rubies/ruby-2.0.0-p451-rvm/bin/ruby extconf.rb /Users/yandod/.rvm/rubies/ruby-2.0.0-p451-rvm/bin/ruby: invalid option -H (-h will show valid options) (RuntimeError) extconf failed, exit code 1 Gem files will remain installed in /Volumes/Macintosh HD 2/develop/doorkeeper-jp-admin/vendor/bundle/gems/nokogiri-1.6.1 for inspection. Results logged to /Volumes/Macintosh HD 2/develop/doorkeeper-jp-admin/vendor/bundle/extensions/x86_64-darwin-13/2.0.0/nokogiri-1.6.1/gem_make.out An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling. $ gem install nokogiri -v '1.6.1' Building native extensions. This could take a while... Successfully installed nokogiri-1.6.1 1 gem installed $rvm所需资源 检查osx的需求。 “/usr/local/etc/openssl/cert.pem”中的证书已经是最新的。 要求安装成功。 Yusuke-no-MacBook-Air-2:门卫jp管理员yandod$bundle安装 从中获取gem元数据https://rubygems.org/......... 从中获取附加元数据https://rubygems.org/.. 正在解析依赖项。。。 使用rake 10.3.1 使用bundler 1.6.2 使用mini_portile 0.5.3 Gem::Ext::BuildError:错误:无法生成Gem本机扩展。 /Users/yandod/.rvm/rubies/ruby-2.0.0-p451-rvm/bin/ruby-extconf.rb /Users/yandod/.rvm/rubies/ruby-2.0.0-p451-rvm/bin/ruby:无效选项-H(-H将显示有效选项)(运行时错误) extconf失败,退出代码1 Gem文件将继续安装在/Volumes/Macintosh HD 2/develop/doorkeeper jp admin/vendor/bundle/gems/nokogiri-1.6.1中,以供检查。 结果记录到/Volumes/Macintosh HD 2/develope/doorkeeper jp admin/vendor/bundle/extensions/x86_64-darwin-13/2.0.0/nokogiri-1.6.1/gem_make.out 安装nokogiri(1.6.1)时出错,Bundler无法继续。 在绑定之前,确保'gem install nokogiri-v'1.6.1'成功。 gem安装的结果

$ rvm requirements Checking requirements for osx. Certificates in '/usr/local/etc/openssl/cert.pem' already are up to date. Requirements installation successful. Yusuke-no-MacBook-Air-2:doorkeeper-jp-admin yandod$ bundle install Fetching gem metadata from https://rubygems.org/......... Fetching additional metadata from https://rubygems.org/.. Resolving dependencies... Using rake 10.3.1 Using bundler 1.6.2 Using mini_portile 0.5.3 Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /Users/yandod/.rvm/rubies/ruby-2.0.0-p451-rvm/bin/ruby extconf.rb /Users/yandod/.rvm/rubies/ruby-2.0.0-p451-rvm/bin/ruby: invalid option -H (-h will show valid options) (RuntimeError) extconf failed, exit code 1 Gem files will remain installed in /Volumes/Macintosh HD 2/develop/doorkeeper-jp-admin/vendor/bundle/gems/nokogiri-1.6.1 for inspection. Results logged to /Volumes/Macintosh HD 2/develop/doorkeeper-jp-admin/vendor/bundle/extensions/x86_64-darwin-13/2.0.0/nokogiri-1.6.1/gem_make.out An error occurred while installing nokogiri (1.6.1), and Bundler cannot continue. Make sure that `gem install nokogiri -v '1.6.1'` succeeds before bundling. $ gem install nokogiri -v '1.6.1' Building native extensions. This could take a while... Successfully installed nokogiri-1.6.1 1 gem installed $gem安装nokogiri-v'1.6.1' 构建本机扩展。这可能需要一段时间。。。 已成功安装nokogiri-1.6.1 已安装1个gem 相关软件的版本:

$ bundle --version Bundler version 1.6.2 $ rvm --version rvm 1.25.25 (stable) by Wayne E. Seguin , Michal Papis [https://rvm.io/] $ gem --version 2.2.2 $bundle--版本 捆绑包版本1.6.2 $rvm--版本 rvm 1.25.25(稳定)作者:韦恩E.塞根,迈克尔·帕皮斯[https://rvm.io/] $gem--版本 2.2.2 增加: 我的绑定器配置

$ cat ~/.bundle/config BUNDLE_PATH: ./vendor/bundle BUNDLE_BUILD__NOKOGIRI: --use-system-libraries --with-iconv-dir=/usr/local/opt/libiconv --with-xml2-config=/usr/local/opt/libxml2/bin/xml2-config --with-xslt-config=/usr/local/opt/libxslt/bin/xslt-config $cat~/.bundle/config 捆绑路径:/供应商/捆绑 BUNDLE\u BUILD\u NOKOGIRI:--使用系统库--使用iconv dir=/usr/local/opt/libiconv--使用-xml2-config=/usr/local/opt/libxml2/bin/xml2-config--使用xslt-config=/usr/local/opt/libxslt/bin/xslt-config 尝试:
rvm稳定下来

然后:
rvm-reload

执行
gem-install
时,gem将安装到gems的默认系统位置(您可以查看
gem-env
的输出)

但是,当您执行
捆绑安装时
您将gem安装到系统的gem存储库以外的位置(因为您已经为捆绑配置了自定义路径
捆绑路径=。/vendor/bundle
),因此即使gem存在于系统的gem存储库中,Bundler也会安装gem,因为你没有用那个

现在,出于某种原因,
gem
命令在定位构建gem本机扩展所需的系统库方面没有问题,但是Bundler已经找到了。因此,您需要做的是指示Bundler这些库的路径

因此,假设您使用的是自制软件:

  • 确保已安装所有本机依赖项:
    brew安装libxml2 libxslt libiconv

  • 指导Bundler如何构建nokogiri宝石:
    bundle config build.nokogiri--使用系统库--使用iconv dir=“$(brew--前缀libiconv)”--使用-xml2-config=“$(brew--前缀libxml2)/bin/xml2-config”--使用xslt-config=“$(brew--前缀libxslt)/bin/xslt-config”

  • 安装捆绑包,向nokogiri发出使用上述库的信号:
    NOKOGIRI\u使用系统库=1个捆绑安装

应该是这样

编辑:

尽管上述步骤可能仍然是必要的,但实际问题似乎是项目路径中存在“空格”字符

考虑到取消设置bundle path选项可以使事情顺利进行,我更仔细地查看了原始的
bundle安装
输出,我知道您使用的是一个名称上带有“space”字符的外部驱动器

项目路径(包括“空间”或特殊字符)通常是许多工具的问题,因此您应该避免使用它们。请尝试重命名卷或将项目移动到其他位置


对不起,我以前没有意识到。

您应该将这些目录的所有权更改为您的用户

sudo chown -R $(whoami) /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig
并确保您的用户必须具有写入权限

chmod u+w /usr/local/include /usr/local/lib /usr/local/lib/pkgconfig

bundle install
安装gem后仍会失败?即使在“gem install”后仍会失败如果安装了gem,bundler不应再次尝试安装它(在这种情况下,bundler说的是“使用”而不是“安装”)。可能您正在运行的
bundle install
与您正在运行的
gem install nokogiri
不同的ruby/gemset中运行了
bundle install
?我在项目目录下设置了bundle path。$cat~/.bundle/config---bundle\u路径:./vendor/bundleOk,我想是怎么回事。我将尝试详细说明一个答案。我做到了,但仍然失败。错误消息仍然与以前相同。正确。我使用的是自制软件。很抱歉我的问题,但我需要它来帮助您,postgresql是用自制软件安装的?我没有出于任何目的使用postgresql。我遵循了您展示的步骤。但仍然看到相同的错误。您可以尝试在项目目录下取消捆绑路径以查看是否成功吗?取消捆绑路径使事情正常工作。目前,不使用捆绑路径可能是解决这个问题的方法。我正在编辑答案。看到它与系统路径一起工作,我更仔细地检查了您的
bundle安装
输出,我知道您似乎正在使用名称上带有“space”字符的外部驱动器。