【问题标题】:Make sure that 'gem install ~ ' succeeds before bundling在捆绑之前确保“gem install ~”成功
【发布时间】:2014-12-15 12:53:27
【问题描述】:

我今天开始在 Rails 上学习 Ruby。 我已经安装了 Ruby、DEVELOPMENT KIT、SQLite3、bundler 和 rails。

接下来,我的教科书说要在控制台中运行rails new todo。然后,出现以下消息:

Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read
server certificate B: certificate verify failed (https://rubygems.org/gems/coffee-rails-4.0.1.gem)
An error occurred while installing execjs (2.2.2), and Bundler cannot
continue.
Make sure that `gem install execjs -v '2.2.2'` succeeds before bundling.

我做了如下。

C:\rubyfolder>gem install execjs -v 2.2.2

然后出现如下:

Fetching: execjs-2.2.2.gem (100%)
Successfully installed execjs-2.2.2
Parsing documentation for execjs-2.2.2
Installing ri documentation for execjs-2.2.2
Done installing documentation for execjs after 1 seconds
WARNING:  Unable to pull data from 'https://rubygems.org/': SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
1 gem installed

接下来,我再次运行rails new todo。然后,上面消息中的execjscoffee-script替换的消息就出现了。

Make sure that `gem install coffee-script -v '2.3.0'` succeeds before bundling.

接下来,我安装了 coffee-script。

我已经将这种工作重复了 3 或 4 次,但没有完成。我该怎么办?

execjs 可能不是这个周期的第一个。我看不到日志的第一部分)

【问题讨论】:

  • 这可能与 Windows 的 SSL 问题有关。检查my answer 的主题,看看是否有帮助。
  • 谢谢。我检查一下。

标签: ruby-on-rails ruby


【解决方案1】:

我也遇到过类似的问题。这对我有用:

  1. 在您的 Gemfile 或您指定 gem 列表的任何地方,并将 source 'https://......' 替换为此 source 'http://.......' 否则它将在捆绑前继续询问 Make sure that gem install gem_name__ v xxx' 是否成功。`
  2. bundle installrails new todo
  3. 完成,这次没有错误。

【讨论】:

    【解决方案2】:

    单独运行gem install 并不能解决问题的根源。看起来您没有为 Rails 安装所有需要的开发依赖项。尝试在official instruction 内完成库。

    另外,我从您的路径中看到您在 Windows 上尝试它,可能您需要以这种方式安装依赖项,因为官方文档没有提供此操作系统的说明: gem install rails --include-dependencies

    【讨论】:

    • 运行 gem install 时,出现如下错误:执行 gem ... (OptionParser::InvalidOption) 无效选项:--include-dependencies
    猜你喜欢
    • 2017-08-27
    • 1970-01-01
    • 2021-07-19
    • 1970-01-01
    • 2015-07-21
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多