Rails 找不到 rake gem

2024-01-03

我有一个在 docker 中运行的基本 Rails 应用程序。我可以很好地启动它并提供响应。我可以跑rake -T正好。但我无法运行 Rails 生成命令。它无法告诉我Could not find rake-12.3.1 in any of the sources

$ docker-compose run main bundle exec rails generate controller Welcome index
Starting cognitopoc_db_1 ... done
Could not find rake-12.3.1 in any of the sources
Run `bundle install` to install missing gems.

这是我的捆绑包环境:

$ docker-compose run main bundle env 
Starting cognitopoc_db_1 ... done
## Environment

Bundler       1.16.1
  Platforms   ruby, x86_64-linux
Ruby          2.5.1p57 (2018-03-29 revision 63029) [x86_64-linux]
  Full Path   /usr/local/bin/ruby
  Config Dir  /usr/local/etc
RubyGems      2.7.6
  Gem Home    /usr/local/bundle
  Gem Path    /root/.gem/ruby/2.5.0:/usr/local/lib/ruby/gems/2.5.0:/usr/local/bundle
  User Path   /root/.gem/ruby/2.5.0
  Bin Dir     /usr/local/bundle/bin
Tools         
  Git         2.11.0
  RVM         not installed
  rbenv       not installed
  chruby      not installed

## Bundler Build Metadata

Built At          2017-12-21
Git SHA           0034ef341
Released Version  true

## Bundler settings

path
  Set for your local app (/usr/local/bundle/config): "vendor/cache"
  Set via BUNDLE_PATH: "/usr/local/bundle"
jobs
  Set for your local app (/usr/local/bundle/config): "4"
bin
  Set via BUNDLE_BIN: "/usr/local/bundle/bin"
silence_root_warning
  Set via BUNDLE_SILENCE_ROOT_WARNING: true
app_config
  Set via BUNDLE_APP_CONFIG: "/usr/local/bundle"
gemfile
  Set via BUNDLE_GEMFILE: "/myapp/Gemfile"

## Gemfile

### Gemfile

ruby
source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
  "https://github.com/#{repo_name}.git"
end

gem 'coffee-rails', '~> 4.2'
gem 'jbuilder', '~> 2.5'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 3.7'
gem 'rails', '~> 5.1.6'
gem 'sass-rails', '~> 5.0'
gem 'turbolinks', '~> 5'
gem 'uglifier', '>= 1.3.0'

# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'

# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

group :development, :test do
  gem 'byebug', platforms: %i[mri mingw x64_mingw]
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  gem 'listen', '>= 3.0.5', '< 3.2'

  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

### Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (5.1.6)
      actionpack (= 5.1.6)
      nio4r (~> 2.0)
      websocket-driver (~> 0.6.1)
    actionmailer (5.1.6)
      actionpack (= 5.1.6)
      actionview (= 5.1.6)
      activejob (= 5.1.6)
      mail (~> 2.5, >= 2.5.4)
      rails-dom-testing (~> 2.0)
    actionpack (5.1.6)
      actionview (= 5.1.6)
      activesupport (= 5.1.6)
      rack (~> 2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.2)
    actionview (5.1.6)
      activesupport (= 5.1.6)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.0.3)
    activejob (5.1.6)
      activesupport (= 5.1.6)
      globalid (>= 0.3.6)
    activemodel (5.1.6)
      activesupport (= 5.1.6)
    activerecord (5.1.6)
      activemodel (= 5.1.6)
      activesupport (= 5.1.6)
      arel (~> 8.0)
    activesupport (5.1.6)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 0.7, < 2)
      minitest (~> 5.1)
      tzinfo (~> 1.1)
    addressable (2.5.2)
      public_suffix (>= 2.0.2, < 4.0)
    arel (8.0.0)
    builder (3.2.3)
    byebug (10.0.2)
    capybara (2.18.0)
      addressable
      mini_mime (>= 0.1.3)
      nokogiri (>= 1.3.3)
      rack (>= 1.0.0)
      rack-test (>= 0.5.4)
      xpath (>= 2.0, < 4.0)
    childprocess (0.9.0)
      ffi (~> 1.0, >= 1.0.11)
    coffee-rails (4.2.2)
      coffee-script (>= 2.2.0)
      railties (>= 4.0.0)
    coffee-script (2.4.1)
      coffee-script-source
      execjs
    coffee-script-source (1.12.2)
    concurrent-ruby (1.0.5)
    crass (1.0.3)
    erubi (1.7.1)
    execjs (2.7.0)
    ffi (1.9.23)
    globalid (0.4.1)
      activesupport (>= 4.2.0)
    i18n (1.0.0)
      concurrent-ruby (~> 1.0)
    jbuilder (2.7.0)
      activesupport (>= 4.2.0)
      multi_json (>= 1.2)
    listen (3.1.5)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
      ruby_dep (~> 1.2)
    loofah (2.2.2)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    mail (2.7.0)
      mini_mime (>= 0.1.1)
    method_source (0.9.0)
    mini_mime (1.0.0)
    mini_portile2 (2.3.0)
    minitest (5.11.3)
    multi_json (1.13.1)
    nio4r (2.3.0)
    nokogiri (1.8.2)
      mini_portile2 (~> 2.3.0)
    pg (1.0.0)
    public_suffix (3.0.2)
    puma (3.11.3)
    rack (2.0.4)
    rack-test (1.0.0)
      rack (>= 1.0, < 3)
    rails (5.1.6)
      actioncable (= 5.1.6)
      actionmailer (= 5.1.6)
      actionpack (= 5.1.6)
      actionview (= 5.1.6)
      activejob (= 5.1.6)
      activemodel (= 5.1.6)
      activerecord (= 5.1.6)
      activesupport (= 5.1.6)
      bundler (>= 1.3.0)
      railties (= 5.1.6)
      sprockets-rails (>= 2.0.0)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.0.4)
      loofah (~> 2.2, >= 2.2.2)
    railties (5.1.6)
      actionpack (= 5.1.6)
      activesupport (= 5.1.6)
      method_source
      rake (>= 0.8.7)
      thor (>= 0.18.1, < 2.0)
    rake (12.3.1)
    rb-fsevent (0.10.3)
    rb-inotify (0.9.10)
      ffi (>= 0.5.0, < 2)
    ruby_dep (1.5.0)
    rubyzip (1.2.1)
    sass (3.5.6)
      sass-listen (~> 4.0.0)
    sass-listen (4.0.0)
      rb-fsevent (~> 0.9, >= 0.9.4)
      rb-inotify (~> 0.9, >= 0.9.7)
    sass-rails (5.0.7)
      railties (>= 4.0.0, < 6)
      sass (~> 3.1)
      sprockets (>= 2.8, < 4.0)
      sprockets-rails (>= 2.0, < 4.0)
      tilt (>= 1.1, < 3)
    selenium-webdriver (3.11.0)
      childprocess (~> 0.5)
      rubyzip (~> 1.2)
    spring (2.0.2)
      activesupport (>= 4.2)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    sprockets (3.7.1)
      concurrent-ruby (~> 1.0)
      rack (> 1, < 3)
    sprockets-rails (3.2.1)
      actionpack (>= 4.0)
      activesupport (>= 4.0)
      sprockets (>= 3.0.0)
    thor (0.20.0)
    thread_safe (0.3.6)
    tilt (2.0.8)
    turbolinks (5.1.0)
      turbolinks-source (~> 5.1)
    turbolinks-source (5.1.0)
    tzinfo (1.2.5)
      thread_safe (~> 0.1)
    uglifier (4.1.8)
      execjs (>= 0.3.0, < 3)
    websocket-driver (0.6.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.3)
    xpath (3.0.0)
      nokogiri (~> 1.8)

PLATFORMS
  ruby

DEPENDENCIES
  byebug
  capybara (~> 2.13)
  coffee-rails (~> 4.2)
  jbuilder (~> 2.5)
  listen (>= 3.0.5, < 3.2)
  pg (>= 0.18, < 2.0)
  puma (~> 3.7)
  rails (~> 5.1.6)
  sass-rails (~> 5.0)
  selenium-webdriver
  spring
  spring-watcher-listen (~> 2.0.0)
  turbolinks (~> 5)
  uglifier (>= 1.3.0)

BUNDLED WITH
   1.16.1

这是我的 Gemfile:

source 'https://rubygems.org'

git_source(:github) do |repo_name|
  repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
  "https://github.com/#{repo_name}.git"
end

gem 'coffee-rails', '~> 4.2'
gem 'jbuilder', '~> 2.5'
gem 'pg', '>= 0.18', '< 2.0'
gem 'puma', '~> 3.7'
gem 'rails', '~> 5.1.6'
gem 'sass-rails', '~> 5.0'
gem 'turbolinks', '~> 5'
gem 'uglifier', '>= 1.3.0'

group :development, :test do
  gem 'byebug', platforms: %i[mri mingw x64_mingw]
  gem 'capybara', '~> 2.13'
  gem 'selenium-webdriver'
end

group :development do
  gem 'listen', '>= 3.0.5', '< 3.2'
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
end

这是 Dockerfile:

FROM ruby:2.5

ARG DEBIAN_FRONTEND=noninteractive

RUN apt-get update -qq \
  && apt-get install -y \
    apt-utils \
    build-essential \
    nodejs

RUN mkdir /myapp
WORKDIR /myapp
COPY Gemfile* /myapp/
RUN bundle install --path vendor/cache  --jobs=4

COPY . /myapp

CMD bundle exec rails s -p 3000 -b '0.0.0.0'

这是撰写文件:

version: '3'

services:

  db:
    image: postgres
    volumes:
      - ./pg_data:/var/lib/postgresql/data
  main:
    build: .
    volumes:
      - .:/myapp
    ports:
      - "3000:3000"
    depends_on:
      - db

那么为什么我能够跑步rake -T短打不rails generate?


当我通过 Bitbucket 管道容器升级为使用 Ruby 2.5.1 容器时,我开始收到此错误。虽然它可能无法满足每个人的用例,但我可以通过将其添加到我的 bitbucket-pipelines.yml 来使我的 Rails (rake) 命令正常工作:

bundle install --binstubs
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

Rails 找不到 rake gem 的相关文章

随机推荐

  • 如何为 Org 模式内联源代码 src_lang{} 进行语法高亮?

    有没有一种方法可以语法突出显示 Org mode 内联源代码 该代码标记为src ruby Array new 组织模式是否有默认选项 或者还有其他方法可以做到这一点吗 更新 这个特定问题的正确答案如下https stackoverflow
  • 如何调试罕见的死锁?

    我正在尝试调试一个自定义线程池实现rarely僵局 所以我不能使用像 gdb 这样的调试器 因为在出 现死锁之前我已经点击了 100 次 启动 调试器 目前 我正在 shell 脚本中的无限循环中运行线程池测试 但这意味着我看不到变量等 我
  • 如何使用 AsyncHttpClient Android 上传多个文件

    我知道我可以从 AsyncHttpClient 上传单个文件 http loopj com android async http http loopj com android async http File myFile new File
  • 多容器docker(AW​​S)链接是单向的吗?

    我通过 AWS 上的多容器 docker 获得了非对称容器可发现性 也就是说 第一个容器可以找到第二个容器 但第二个容器找不到第一个容器 我在 AWS Elastic Beanstalk 上进行了多容器 Docker 部署 两个容器都使用相
  • 在返回“send_file”的烧瓶函数中,代码似乎不会在后续请求上运行,但文件仍然会下载。为什么?

    我正在使用具有以下路线的 Flask 代码 app route download def download file path certificate docx print certificate printed print os getc
  • 从 php stdin 保存大文件

    请告诉我从 php stdin 保存大文件的最佳方法 iOS 开发人员向我发送大型视频内容到服务器 我必须将其存储到文件中 我读取带有视频数据的标准输入线程并将其写入文件 例如 这样 handle fopen php input rb wh
  • JPlayer Circle Player 第一次使用 vox 制作的 wav 文件时不显示圆圈

    我有一个应用程序 它使用 JPlayer Circle Player 播放短音频以进行转录 这些音频均源自 vox 文件 已由 SoX 转换为 wav 按下 播放 按钮时 将播放音频 但不显示绿色圆圈 剪辑播放后 再次按播放确实会显示绿色圆
  • 为什么这个 std::vector 会给出运行时错误?

    vector
  • .NET:关于 AssemblyVersion,什么定义了二进制兼容性?

    对强命名程序集的哪些更改需要更改 AssemblyVersionAttribute 显然 以可能要求客户端必须更改代码的方式更改公共 api 需要增加 AssemblyVersion 但是 如果对公共 API 进行更改而不需要在客户端中更改
  • C 中的类型双关和联合

    我目前正在开发一个项目来构建一个小型编译器 只是为了它 我决定采用构建一个极其简单的虚拟机作为目标的方法 这样我就不必担心学习 elf intel 汇编等的细节 我的问题是关于 C 中使用联合的类型双关 我决定在虚拟机内存中仅支持 32 位
  • MongoDB嵌套对象聚合计数

    我有一个高度嵌套的 mongoDB 对象集 我想计算与给定条件匹配的子文档的数量编辑 在每个文档中 例如 id chr 20 pos 14371 ref A alt G studies study id Study1 samples sam
  • RuntimeError:DataLoader 工作线程意外退出

    我是 PyTorch 和机器学习的新手 所以我尝试按照这里的教程进行操作 https medium com nutanbhogendrasharma pytorch 卷积神经网络 with mnist dataset 4e8a4265e11
  • 使用 Emscripten 将 R 函数编译为 JavaScript

    我正在尝试使用 Emscripten 将一些用 C 编写的 R 函数编译为 JavaScript 我的第一个任务是移植一个名为pf 源码可以找到here https github com wch r source blob trunk sr
  • PHP:递归地将目录中的所有文件重命名为小写

    我需要帮助 我想递归地将目录中的所有文件重命名为小写 我有一个代码要测试 但它仅在该文件夹内重命名 而不是递归地重命名 我怎样才能让它递归地执行呢 这是我使用的代码 您可以使用 SPL递归目录迭代器 http docs php net ma
  • 不同组的 dplyr 滞后

    我正在尝试使用 dplyr 来改变包含变量的同一组滞后的列以及其他组 之一 的滞后 编辑 抱歉 在第一版中 我在最后一秒按日期重新排列 有点搞乱了顺序 这就是我想要的结果 Here is a minimal code example lib
  • Django - 复制具有 2 个嵌套外键的模型实例

    我是 django 新手 我有一个调查应用程序 其中管理员创建有问题的调查 问题有选择 我已将 save as True 添加到我的调查管理员中 但是当我复制调查时 问题是存在于副本中 但不存在选择 class SurveyAdmin ad
  • Pandas 列数学运算 无错误无答案

    我正在尝试对文件执行一些简单的数学运算 下面的列file 1 csv本质上是动态的 列的数量会不时增加 所以我们无法修复last column master ids csv 在任何预处理之前 Ids ref0 the columns inc
  • CMake编译时生成源代码

    我在使用CMake时遇到以下情况 它必须构建两个应用程序 a 发电机 b 其他的东西 The 发电机没什么花哨的 几个 CPP 文件链接在一起 The 其他的东西 is A 一些 正常 CPP 文件 b 生成的 CPP h 文件 我必须链接
  • VS Code / Metals:如何使用远程调试器调试 Scala sbt 项目?

    我知道这个问题之前已经以某种形式被问过here https stackoverflow com questions 60495320 how to debug scala sbt project in vs code 但我根本不知道如何在
  • Rails 找不到 rake gem

    我有一个在 docker 中运行的基本 Rails 应用程序 我可以很好地启动它并提供响应 我可以跑rake T正好 但我无法运行 Rails 生成命令 它无法告诉我Could not find rake 12 3 1 in any of