rails无法加载此类文件-耙(LoadError) [英] rails cannot load such file -- rake (LoadError)

查看:80
本文介绍了rails无法加载此类文件-耙(LoadError)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想在Heroku中推送我的第一个应用程序,但是我的推送失败.我的外壳中有这个错误;

I want to push my first application in Heroku, but my push failed. I have this error in my shell;

Bundle completed (197.95s)
remote:        Cleaning up the bundler cache.
remote: -----> Installing node-v12.16.2-linux-x64
remote: -----> Installing yarn-v1.22.4
remote:        Detected manifest file, assuming assets were compiled locally
remote: -----> Detecting rails configuration
remote: -----> Detecting rake tasks
remote:
remote:  !
remote:  !     Could not detect rake tasks
remote:  !     ensure you can run `$ bundle exec rake -P` against your app
remote:  !     and using the production group of your Gemfile.
remote:  !     /tmp/build_edcc391d/bin/rake:4:in `require': cannot load such file -- rake (LoadError)
remote:  !     from /tmp/build_edcc391d/bin/rake:4:in `<main>'
remote:  !
remote: /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/helpers/rake_runner.rb:106:in `load_rake_tasks!': Could not detect rake tasks (LanguagePack::Helpers::RakeRunner::CannotLoadRakefileError)
remote: ensure you can run `$ bundle exec rake -P` against your app
remote: and using the production group of your Gemfile.
remote: /tmp/build_edcc391d/bin/rake:4:in `require': cannot load such file -- rake (LoadError)
remote:     from /tmp/build_edcc391d/bin/rake:4:in `<main>'
remote:     from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/ruby.rb:1106:in `rake'
remote:     from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails2.rb:85:in `has_jobs_work_task?'
bla bla bla 

所以,这是我的Gemfile

So, this is my Gemfile

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.7.2'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.1.0'
# Use postgresql as the database for Active Record
gem 'pg', '~> 1.1'
# Use Puma as the app server
gem 'puma', '~> 5.0'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 5.0'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
gem 'bcrypt'

# Use Active Storage variant
# gem 'image_processing', '~> 1.2'

# Reduces boot times through caching; required in config/boot.rb
#gem 'bootsnap', '>= 1.5.1', require: true

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 4.1.0'
  # Display performance information such as SQL time and flame graphs for each request in your browser.
  # Can be configured to work on production as well see: https://github.com/MiniProfiler/rack-mini-profiler/blob/master/README.md
  gem 'rack-mini-profiler', '~> 2.0'
  gem 'listen', '~> 3.3'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 3.26'
  gem 'selenium-webdriver'
  # Easy installation and use of web drivers to run system tests with browsers
  gem 'webdrivers'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]

gem 'faker'
gem 'table_print'
gem 'bootstrap'
gem 'jquery-rails'
gem 'rake'
gem 'rack-timeout'

我想我尝试了一切.这是我尝试解决此错误的方法;

I think I tried everything. Here is what I tried for resolve this error;

  • 在我的Gemfile中添加gem"rake"和gem"rack-timeout"
  • 捆绑安装
  • git commit -m修改后的Gemfile.lock"
  • 添加RAILS_SERVE_STATIC_FILES环境.到您的服务器.
  • RAILS_ENV =生产包执行者rake资产:预编译(如果我运行RAILS_ENV = production bundle exec rake asset:precompile,我有这个)
sh: /Users/mac/Library/Mobile: No such file or directory
sh: /Users/mac/Library/Mobile: No such file or directory
Warning: you are using an unstable release of Node.js (v15.4.0). If you encounter issues with Node.js, consider switching to an Active LTS release. More info: https://docs.npmjs.com/try-the-latest-stable-version-of-node
Everything's up-to-date. Nothing to do

  • git添加公共/资产
  • git commit -m供应商编译的资产"
  • ...
  • 但是什么也没有,我一次又一次遇到此错误...如果有人可以帮助我,我将非常感激.

    But nothing, I have this error again and again ... If anyone can help me I will be very grateful.

    谢谢.

    推荐答案

    确定

      remote: https://rubygems.org/
      specs:
        actioncable (6.1.0)
          actionpack (= 6.1.0)
          activesupport (= 6.1.0)
          nio4r (~> 2.0)
          websocket-driver (>= 0.6.1)
        actionmailbox (6.1.0)
          actionpack (= 6.1.0)
          activejob (= 6.1.0)
          activerecord (= 6.1.0)
          activestorage (= 6.1.0)
          activesupport (= 6.1.0)
          mail (>= 2.7.1)
        actionmailer (6.1.0)
          actionpack (= 6.1.0)
          actionview (= 6.1.0)
          activejob (= 6.1.0)
          activesupport (= 6.1.0)
          mail (~> 2.5, >= 2.5.4)
          rails-dom-testing (~> 2.0)
        actionpack (6.1.0)
          actionview (= 6.1.0)
          activesupport (= 6.1.0)
          rack (~> 2.0, >= 2.0.9)
          rack-test (>= 0.6.3)
          rails-dom-testing (~> 2.0)
          rails-html-sanitizer (~> 1.0, >= 1.2.0)
        actiontext (6.1.0)
          actionpack (= 6.1.0)
          activerecord (= 6.1.0)
          activestorage (= 6.1.0)
          activesupport (= 6.1.0)
          nokogiri (>= 1.8.5)
        actionview (6.1.0)
          activesupport (= 6.1.0)
          builder (~> 3.1)
          erubi (~> 1.4)
          rails-dom-testing (~> 2.0)
          rails-html-sanitizer (~> 1.1, >= 1.2.0)
        activejob (6.1.0)
          activesupport (= 6.1.0)
          globalid (>= 0.3.6)
        activemodel (6.1.0)
          activesupport (= 6.1.0)
        activerecord (6.1.0)
          activemodel (= 6.1.0)
          activesupport (= 6.1.0)
        activestorage (6.1.0)
          actionpack (= 6.1.0)
          activejob (= 6.1.0)
          activerecord (= 6.1.0)
          activesupport (= 6.1.0)
          marcel (~> 0.3.1)
          mimemagic (~> 0.3.2)
        activesupport (6.1.0)
          concurrent-ruby (~> 1.0, >= 1.0.2)
          i18n (>= 1.6, < 2)
          minitest (>= 5.1)
          tzinfo (~> 2.0)
          zeitwerk (~> 2.3)
        addressable (2.7.0)
          public_suffix (>= 2.0.2, < 5.0)
        autoprefixer-rails (10.1.0.0)
          execjs
        bcrypt (3.1.16)
        bindex (0.8.1)
        bootstrap (4.5.3)
          autoprefixer-rails (>= 9.1.0)
          popper_js (>= 1.14.3, < 2)
          sassc-rails (>= 2.0.0)
        builder (3.2.4)
        byebug (11.1.3)
        capybara (3.34.0)
          addressable
          mini_mime (>= 0.1.3)
          nokogiri (~> 1.8)
          rack (>= 1.6.0)
          rack-test (>= 0.6.3)
          regexp_parser (~> 1.5)
          xpath (~> 3.2)
        childprocess (3.0.0)
        concurrent-ruby (1.1.7)
        crass (1.0.6)
        erubi (1.10.0)
        execjs (2.7.0)
        faker (2.15.1)
          i18n (>= 1.6, < 2)
        ffi (1.14.2)
        globalid (0.4.2)
          activesupport (>= 4.2.0)
        i18n (1.8.5)
          concurrent-ruby (~> 1.0)
        jbuilder (2.10.1)
          activesupport (>= 5.0.0)
        jquery-rails (4.4.0)
          rails-dom-testing (>= 1, < 3)
          railties (>= 4.2.0)
          thor (>= 0.14, < 2.0)
        listen (3.3.3)
          rb-fsevent (~> 0.10, >= 0.10.3)
          rb-inotify (~> 0.9, >= 0.9.10)
        loofah (2.8.0)
          crass (~> 1.0.2)
          nokogiri (>= 1.5.9)
        mail (2.7.1)
          mini_mime (>= 0.1.1)
        marcel (0.3.3)
          mimemagic (~> 0.3.2)
        method_source (1.0.0)
        mimemagic (0.3.5)
        mini_mime (1.0.2)
        mini_portile2 (2.4.0)
        minitest (5.14.2)
        nio4r (2.5.4)
        nokogiri (1.10.10)
          mini_portile2 (~> 2.4.0)
        pg (1.2.3)
        popper_js (1.16.0)
        public_suffix (4.0.6)
        puma (5.1.1)
          nio4r (~> 2.0)
        rack (2.2.3)
        rack-mini-profiler (2.3.0)
          rack (>= 1.2.0)
        rack-proxy (0.6.5)
          rack
        rack-test (1.1.0)
          rack (>= 1.0, < 3)
        rack-timeout (0.6.0)
        rails (6.1.0)
          actioncable (= 6.1.0)
          actionmailbox (= 6.1.0)
          actionmailer (= 6.1.0)
          actionpack (= 6.1.0)
          actiontext (= 6.1.0)
          actionview (= 6.1.0)
          activejob (= 6.1.0)
          activemodel (= 6.1.0)
          activerecord (= 6.1.0)
          activestorage (= 6.1.0)
          activesupport (= 6.1.0)
          bundler (>= 1.15.0)
          railties (= 6.1.0)
          sprockets-rails (>= 2.0.0)
        rails-dom-testing (2.0.3)
          activesupport (>= 4.2.0)
          nokogiri (>= 1.6)
        rails-html-sanitizer (1.3.0)
          loofah (~> 2.3)
        railties (6.1.0)
          actionpack (= 6.1.0)
          activesupport (= 6.1.0)
          method_source
          rake (>= 0.8.7)
          thor (~> 1.0)
        rake (13.0.3)
        rb-fsevent (0.10.4)
        rb-inotify (0.10.1)
          ffi (~> 1.0)
        regexp_parser (1.8.2)
        rubyzip (2.3.0)
        sass-rails (6.0.0)
          sassc-rails (~> 2.1, >= 2.1.1)
        sassc (2.4.0)
          ffi (~> 1.9)
        sassc-rails (2.1.2)
          railties (>= 4.0.0)
          sassc (>= 2.0)
          sprockets (> 3.0)
          sprockets-rails
          tilt
        selenium-webdriver (3.142.7)
          childprocess (>= 0.5, < 4.0)
          rubyzip (>= 1.2.2)
        semantic_range (2.3.1)
        spring (2.1.1)
        sprockets (4.0.2)
          concurrent-ruby (~> 1.0)
          rack (> 1, < 3)
        sprockets-rails (3.2.2)
          actionpack (>= 4.0)
          activesupport (>= 4.0)
          sprockets (>= 3.0.0)
        table_print (1.5.7)
        thor (1.0.1)
        tilt (2.0.10)
        tzinfo (2.0.4)
          concurrent-ruby (~> 1.0)
        web-console (4.1.0)
          actionview (>= 6.0.0)
          activemodel (>= 6.0.0)
          bindex (>= 0.4.0)
          railties (>= 6.0.0)
        webdrivers (4.4.2)
          nokogiri (~> 1.6)
          rubyzip (>= 1.3.0)
          selenium-webdriver (>= 3.0, < 4.0)
        webpacker (5.2.1)
          activesupport (>= 5.2)
          rack-proxy (>= 0.6.1)
          railties (>= 5.2)
          semantic_range (>= 2.3.0)
        websocket-driver (0.7.3)
          websocket-extensions (>= 0.1.0)
        websocket-extensions (0.1.5)
        xpath (3.2.0)
          nokogiri (~> 1.8)
        zeitwerk (2.4.2)
    
    PLATFORMS
      x86_64-darwin-17
    
    DEPENDENCIES
      bcrypt
      bootstrap
      byebug
      capybara (>= 3.26)
      faker
      jbuilder (~> 2.7)
      jquery-rails
      listen (~> 3.3)
      pg (~> 1.1)
      puma (~> 5.0)
      rack-mini-profiler (~> 2.0)
      rack-timeout
      rails (~> 6.1.0)
      rake
      sass-rails (>= 6)
      selenium-webdriver
      spring
      table_print
      tzinfo-data
      web-console (>= 4.1.0)
      webdrivers
      webpacker (~> 5.0)
    
    RUBY VERSION
       ruby 2.7.2p137
    
    BUNDLED WITH
       2.2.3
    

    编辑我只是将PLATFORMS x86_64-darwin-17换成红宝石.现在我有很多这样的错误;

    EDIT I just remplace in PLATFORMS x86_64-darwin-17 to ruby. And now I have a lot of errors like this;

    remote:  !
    remote:  !     Could not detect rake tasks
    remote:  !     ensure you can run `$ bundle exec rake -P` against your app
    remote:  !     and using the production group of your Gemfile.
    remote:  !     rake about
    remote:  !     environment
    remote:  !     rake action_mailbox:ingress:environment
    remote:  !     rake action_mailbox:ingress:exim
    remote:  !     action_mailbox:ingress:environment
    remote:  !     rake action_mailbox:ingress:postfix
    remote:  !     action_mailbox:ingress:environment
    remote:  !     rake action_mailbox:ingress:qmail
    remote:  !     action_mailbox:ingress:environment
    remote:  !     rake action_mailbox:install
    remote:  !     rake action_mailbox:install:migrations
    remote:  !     rake action_text:install
    remote:  !     rake action_text:install:migrations
    remote:  !     rake active_storage:install
    remote:  !     environment
    remote:  !     rake active_storage:install:migrations
    remote:  !     rake active_storage:update
    remote:  !     environment
    remote:  !     rake app:binstub:yarn
    remote:  !     rake app:template
    remote:  !     environment
    remote:  !     rake app:templates:copy
    remote:  !     rake app:update
    remote:  !     update:configs
    remote:  !     update:bin
    remote:  !     update:active_storage
    remote:  !     update:upgrade_guide_info
    remote:  !     rake app:update:active_storage
    remote:  !     rake app:update:bin
    bla bla bla
    

    这篇关于rails无法加载此类文件-耙(LoadError)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆