首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Gem::Gem未找到异常

Gem::Gem未找到异常
EN

Stack Overflow用户
提问于 2020-11-04 14:15:17
回答 2查看 1.4K关注 0票数 0

我的拉请求在指针上一直失败,出现了这个Ruby错误:

代码语言:javascript
复制
Run[ -f Gemfile ] && bundle --deployment
gem install --no-document rspec:'~>3.0'
shell: /bin/bash -e {0}/opt/hostedtoolcache/Ruby/2.6.6/x64/lib/ruby/2.6.0/rubygems.rb:283:in 
`find_spec_for_exe': Could not find 'bundler' (2.1.2) required by your 
/home/runner/work/Telegram_Inspirational_Bot/Telegram_Inspirational_Bot/Gemfile.lock. (Gem::GemNotFoundException)
To update to the latest version installed on your system, run `bundle update --bundler`.To install the missing version, run `gem install bundler:2.1.2`from/opt/hostedtoolcache/Ruby/2.6.6/x64/lib/ruby/2.6.0/rubygems.rb:302:in`activate_bin_path'from/opt/hostedtoolcache/Ruby/2.6.6/x64/bin/bundle:23:in `<main>'Error: Process completed with exit code 1.

截图CI

我的客户不能运行我的应用程序

我的客户不能运行我的应用程序。我肯定是因为这个错误。在发出拉请求后,他得到了这个错误:

代码语言:javascript
复制
The error: 
bundle install
Fetching gem metadata from https://rubygems.org/.........
Resolving dependencies...
Bundler could not find compatible versions for gem "bundle exec rspec":
  In Gemfile:
    telegram-bot-ruby was resolved to 0.13.0, which depends on
      virtus was resolved to 1.0.5, which depends on
        bundle exec rspec

Could not find gem 'bundle exec rspec', which is required by gem 'virtus', in any of the sources.

我真的无法解决这个问题,因为我最初以为这是创业板文件中的一个bug。

Gem文件:

代码语言:javascript
复制
source 'https://rubygems.org'

git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }

# gem "rails"

gem 'json'
gem 'net-http-persistent', '~> 2.9', '>= 2.9.4'
gem 'rubocop', '~>0.81.0'
gem 'telegram-bot-ruby'

Gem文件锁:

代码语言:javascript
复制
GEM
  remote: https://rubygems.org/
  specs:
    axiom-types (0.1.1)
      descendants_tracker (~> 0.0.4)
      ice_nine (~> 0.11.0)
      thread_safe (~> 0.3, >= 0.3.1)
    coercible (1.0.0)
      descendants_tracker (~> 0.0.1)
    descendants_tracker (0.0.4)
      thread_safe (~> 0.3, >= 0.3.1)
    equalizer (0.0.11)
    faraday (1.1.0)
      multipart-post (>= 1.2, < 3)
      ruby2_keywords
    ice_nine (0.11.2)
    inflecto (0.0.2)
    json (2.3.1)
    multipart-post (2.1.1)
    net-http-persistent (2.9.4)
    ruby2_keywords (0.0.2)
    telegram-bot-ruby (0.13.0)
      faraday
      inflecto
      virtus
    thread_safe (0.3.6)
    virtus (1.0.5)
      axiom-types (~> 0.1)
      coercible (~> 1.0)
      descendants_tracker (~> 0.0, >= 0.0.3)
      equalizer (~> 0.0, >= 0.0.9)

PLATFORMS
  ruby

DEPENDENCIES
  json
  net-http-persistent (~> 2.9, >= 2.9.4)
  telegram-bot-ruby

BUNDLED WITH
   2.1.4
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2020-11-15 14:19:03

这个问题出现在我正在使用的linter.yml上。最近,我的一个朋友通过修改linter.yml来解决这个问题:

名称:林特斯

on: pull_request

职位:

红宝石警察:

代码语言:javascript
复制
name: Rubocop

runs-on: ubuntu-18.04

steps:
  - uses: actions/checkout@v2
  - uses: actions/setup-ruby@v1
    with:
      ruby-version: 2.6.x
  - name: Setup Rubocop
    run: |
      gem install --no-document rubocop:'~>0.81.0' # https://docs.rubocop.org/en/stable/installation/
      [ -f .rubocop.yml ] || wget https://raw.githubusercontent.com/microverseinc/linters-config/master/ruby/.rubocop.yml
  - name: Rubocop Report
    run: rubocop --color

至:

名称:测试

on: pull_request

职位:

rspec:

代码语言:javascript
复制
name: RSpec

runs-on: ubuntu-18.04

steps:

  - uses: actions/checkout@v2

  - uses: actions/setup-ruby@v1
    with:
      ruby-version: 2.6.x
  - name: Setup Bundler
      run:  gem install bundler:2.1.4
  - name: Setup RSpec
    run: |
      [ -f Gemfile ] && bundle --deployment
      gem install --no-document rspec:'~>3.0'
  - name: RSpec Report
    run: rspec --force-color --format documentation

后者起作用了。

票数 0
EN

Stack Overflow用户

发布于 2020-11-05 17:28:52

我认为这里有两个问题。

没有安装绑定器(或者安装了错误的版本)

无论系统运行的是测试/ linter (似乎是Github的CI工具),都没有安装正确版本的bundler。试着添加

代码语言:javascript
复制
gem install bundler:2.1.2

调用测试套件的工作。

RSpec不包含在Gemfile中。

RSpec是必需的依赖项。似乎您正在测试作业中安装rspec,但它没有包含在Gemfile中。试着添加

代码语言:javascript
复制
gem 'rspec'

寄给你的档案。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/64681725

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档