不带链轮且带传动轴的 Rails 7 出现错误且无法部署

问题描述 投票:0回答:2

我尝试在不使用 Sprockets 且使用 Propshaft 的情况下部署 Rails 7 应用程序,但出现此错误。

Gemfile
不包含宝石
sprockets
sprockets-rails

rake asset:precompile
有效。

构建日志

       Cleaning assets
       Running: rake assets:clean
       /tmp/build_76f68a37/vendor/ruby-2.7.6/lib/ruby/2.7.0/net/protocol.rb:66: warning: already initialized constant Net::ProtocRetryError
       /tmp/build_76f68a37/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:68: warning: previous definition of ProtocRetryError was here
       /tmp/build_76f68a37/vendor/ruby-2.7.6/lib/ruby/2.7.0/net/protocol.rb:206: warning: already initialized constant Net::BufferedIO::BUFSIZE
       /tmp/build_76f68a37/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:208: warning: previous definition of BUFSIZE was here
       /tmp/build_76f68a37/vendor/ruby-2.7.6/lib/ruby/2.7.0/net/protocol.rb:503: warning: already initialized constant Net::NetPrivate::Socket
       /tmp/build_76f68a37/vendor/bundle/ruby/2.7.0/gems/net-protocol-0.1.3/lib/net/protocol.rb:504: warning: previous definition of Socket was here
       I, [2022-09-05T17:39:05.172047 #769]  INFO -- : Removed tailwind-c8d16e9a4ef866dc7b55c35dc8aa6c8c2ec9658b9a1c72a6afbf6610a18edaf6.css
       I, [2022-09-05T17:39:05.172255 #769]  INFO -- : Removed application-b65b0e7845866246a59d5ff58e338888b816663b892c38d5cf2a7afb82f5819d.css
-----> Detecting rails configuration
 !
 !     undefined method `<' for nil:NilClass
 !     
 !     if sprockets_version < Gem::Version.new("2.12.5")
 !     ^
 !
/tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails3.rb:137:in `sprocket_version_upgrade_needed': undefined method `<' for nil:NilClass (NoMethodError)
    if sprockets_version < Gem::Version.new("2.12.5")
                         ^
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails3.rb:53:in `best_practice_warnings'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/ruby.rb:106:in `compile'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails2.rb:55:in `compile'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails3.rb:37:in `compile'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails4.rb:30:in `compile'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails6.rb:17:in `compile'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/bin/support/ruby_compile:19:in `block in <main>'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/base.rb:175:in `log'
    from /tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/bin/support/ruby_compile:18:in `<main>'
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

我滑走了

config/assets.rb
,可能没有与 sprocket 相关的文件。

Gemfile

# frozen_string_literal: true

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

ruby "2.7.6"

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem "rails", "~> 7.0.0"
# Use postgresql as the database for Active Record
gem "pg", ">= 0.18", "< 2.0"
# Use Puma as the app server
gem "puma", "~> 4.3"
# Use SCSS for stylesheets
# gem "sass-rails"
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem "turbolinks", "~> 5"
# 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', '~> 3.1.7'

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

# Reduces boot times through caching; required in config/boot.rb
gem "bootsnap", ">= 1.4.2", require: false

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

group :development do
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem "listen", ">= 3.0.5", "< 3.2"
  gem "web-console", ">= 3.3.0"
  # 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"
  # Rubocop
  gem "rubocop", require: false
  gem "rubocop-rails", require: false
  gem "rubocop-performance", require: false

  gem "slim_lint"

  gem "guard"
  gem "guard-rubocop"
end

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

group :production do
  # gem 'sqreen', '~> 1.24', '>= 1.24.3'
end

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

gem "aws-sdk-s3"
gem "aws-sdk-rails"

gem "mini_magick"
gem "streamio-ffmpeg"

# User Authentication
gem "devise"

# Algoria
gem "algoliasearch-rails"

gem "gon"
gem "rinku"

gem "slim"
gem "html2slim"

gem "gravtastic"

gem "font-awesome-sass", "~> 6.1.1"

gem "tailwindcss-rails", "~> 2.0"

gem "jsbundling-rails", "~> 1.0"

gem "http_accept_language", "~> 2.1"

gem "hotwire-livereload", "~> 1.2"

gem "turbo-rails", "~> 1.1"

gem "cssbundling-rails", "~> 1.1"

gem "serviceworker-rails", "~> 0.6.0"

gem "propshaft", "~> 0.6.4"

Gemfile.lock

GEM
  remote: https://rubygems.org/
  specs:
    actioncable (7.0.3.1)
      actionpack (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      nio4r (~> 2.0)
      websocket-driver (>= 0.6.1)
    actionmailbox (7.0.3.1)
      actionpack (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      mail (>= 2.7.1)
      net-imap
      net-pop
      net-smtp
    actionmailer (7.0.3.1)
      actionpack (= 7.0.3.1)
      actionview (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      mail (~> 2.5, >= 2.5.4)
      net-imap
      net-pop
      net-smtp
      rails-dom-testing (~> 2.0)
    actionpack (7.0.3.1)
      actionview (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      rack (~> 2.0, >= 2.2.0)
      rack-test (>= 0.6.3)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.0, >= 1.2.0)
    actiontext (7.0.3.1)
      actionpack (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      globalid (>= 0.6.0)
      nokogiri (>= 1.8.5)
    actionview (7.0.3.1)
      activesupport (= 7.0.3.1)
      builder (~> 3.1)
      erubi (~> 1.4)
      rails-dom-testing (~> 2.0)
      rails-html-sanitizer (~> 1.1, >= 1.2.0)
    activejob (7.0.3.1)
      activesupport (= 7.0.3.1)
      globalid (>= 0.3.6)
    activemodel (7.0.3.1)
      activesupport (= 7.0.3.1)
    activerecord (7.0.3.1)
      activemodel (= 7.0.3.1)
      activesupport (= 7.0.3.1)
    activestorage (7.0.3.1)
      actionpack (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      marcel (~> 1.0)
      mini_mime (>= 1.1.0)
    activesupport (7.0.3.1)
      concurrent-ruby (~> 1.0, >= 1.0.2)
      i18n (>= 1.6, < 2)
      minitest (>= 5.1)
      tzinfo (~> 2.0)
    addressable (2.8.1)
      public_suffix (>= 2.0.2, < 6.0)
    algolia (2.2.5)
      faraday (>= 0.15, < 2.0)
      multi_json (~> 1.0)
      net-http-persistent
    algoliasearch-rails (2.2.1)
      algolia (< 3.0.0)
      json (>= 1.5.1)
    ast (2.4.2)
    aws-eventstream (1.2.0)
    aws-partitions (1.626.0)
    aws-record (2.7.0)
      aws-sdk-dynamodb (~> 1.18)
    aws-sdk-core (3.140.0)
      aws-eventstream (~> 1, >= 1.0.2)
      aws-partitions (~> 1, >= 1.525.0)
      aws-sigv4 (~> 1.1)
      jmespath (~> 1, >= 1.6.1)
    aws-sdk-dynamodb (1.76.0)
      aws-sdk-core (~> 3, >= 3.127.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-kms (1.58.0)
      aws-sdk-core (~> 3, >= 3.127.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-rails (3.6.2)
      aws-record (~> 2)
      aws-sdk-ses (~> 1)
      aws-sdk-sqs (~> 1)
      aws-sessionstore-dynamodb (~> 2)
      concurrent-ruby (~> 1)
      railties (>= 5.2.0)
    aws-sdk-s3 (1.114.0)
      aws-sdk-core (~> 3, >= 3.127.0)
      aws-sdk-kms (~> 1)
      aws-sigv4 (~> 1.4)
    aws-sdk-ses (1.47.0)
      aws-sdk-core (~> 3, >= 3.127.0)
      aws-sigv4 (~> 1.1)
    aws-sdk-sqs (1.51.1)
      aws-sdk-core (~> 3, >= 3.127.0)
      aws-sigv4 (~> 1.1)
    aws-sessionstore-dynamodb (2.0.1)
      aws-sdk-dynamodb (~> 1)
      rack (~> 2)
    aws-sigv4 (1.5.1)
      aws-eventstream (~> 1, >= 1.0.2)
    bcrypt (3.1.18)
    bindex (0.8.1)
    bootsnap (1.13.0)
      msgpack (~> 1.2)
    builder (3.2.4)
    byebug (11.1.3)
    capybara (3.37.1)
      addressable
      matrix
      mini_mime (>= 0.1.3)
      nokogiri (~> 1.8)
      rack (>= 1.6.0)
      rack-test (>= 0.6.3)
      regexp_parser (>= 1.5, < 3.0)
      xpath (~> 3.2)
    childprocess (4.1.0)
    coderay (1.1.3)
    concurrent-ruby (1.1.10)
    connection_pool (2.2.5)
    crass (1.0.6)
    cssbundling-rails (1.1.1)
      railties (>= 6.0.0)
    devise (4.8.1)
      bcrypt (~> 3.0)
      orm_adapter (~> 0.1)
      railties (>= 4.1.0)
      responders
      warden (~> 1.2.3)
    digest (3.1.0)
    erubi (1.11.0)
    faraday (1.10.2)
      faraday-em_http (~> 1.0)
      faraday-em_synchrony (~> 1.0)
      faraday-excon (~> 1.1)
      faraday-httpclient (~> 1.0)
      faraday-multipart (~> 1.0)
      faraday-net_http (~> 1.0)
      faraday-net_http_persistent (~> 1.0)
      faraday-patron (~> 1.0)
      faraday-rack (~> 1.0)
      faraday-retry (~> 1.0)
      ruby2_keywords (>= 0.0.4)
    faraday-em_http (1.0.0)
    faraday-em_synchrony (1.0.0)
    faraday-excon (1.1.0)
    faraday-httpclient (1.0.1)
    faraday-multipart (1.0.4)
      multipart-post (~> 2)
    faraday-net_http (1.0.1)
    faraday-net_http_persistent (1.2.0)
    faraday-patron (1.0.0)
    faraday-rack (1.0.0)
    faraday-retry (1.0.3)
    ffi (1.15.5)
    font-awesome-sass (6.1.2)
      sassc (~> 2.0)
    formatador (1.1.0)
    globalid (1.0.0)
      activesupport (>= 5.0)
    gon (6.4.0)
      actionpack (>= 3.0.20)
      i18n (>= 0.7)
      multi_json
      request_store (>= 1.0)
    gravtastic (3.2.6)
    guard (2.18.0)
      formatador (>= 0.2.4)
      listen (>= 2.7, < 4.0)
      lumberjack (>= 1.0.12, < 2.0)
      nenv (~> 0.1)
      notiffany (~> 0.0)
      pry (>= 0.13.0)
      shellany (~> 0.0)
      thor (>= 0.18.1)
    guard-rubocop (1.5.0)
      guard (~> 2.0)
      rubocop (< 2.0)
    hotwire-livereload (1.2.2)
      listen (>= 3.0.0)
      rails (>= 6.0.0)
    hpricot (0.8.6)
    html2slim (0.2.0)
      hpricot
    http_accept_language (2.1.1)
    i18n (1.12.0)
      concurrent-ruby (~> 1.0)
    jbuilder (2.11.5)
      actionview (>= 5.0.0)
      activesupport (>= 5.0.0)
    jmespath (1.6.1)
    jsbundling-rails (1.0.3)
      railties (>= 6.0.0)
    json (2.6.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.18.0)
      crass (~> 1.0.2)
      nokogiri (>= 1.5.9)
    lumberjack (1.2.8)
    mail (2.7.1)
      mini_mime (>= 0.1.1)
    marcel (1.0.2)
    matrix (0.4.2)
    method_source (1.0.0)
    mini_magick (4.11.0)
    mini_mime (1.1.2)
    mini_portile2 (2.8.0)
    minitest (5.16.3)
    msgpack (1.5.6)
    multi_json (1.15.0)
    multipart-post (2.2.3)
    nenv (0.3.0)
    net-http-persistent (4.0.1)
      connection_pool (~> 2.2)
    net-imap (0.2.3)
      digest
      net-protocol
      strscan
    net-pop (0.1.1)
      digest
      net-protocol
      timeout
    net-protocol (0.1.3)
      timeout
    net-smtp (0.3.1)
      digest
      net-protocol
      timeout
    nio4r (2.5.8)
    nokogiri (1.13.8)
      mini_portile2 (~> 2.8.0)
      racc (~> 1.4)
    notiffany (0.1.3)
      nenv (~> 0.1)
      shellany (~> 0.0)
    orm_adapter (0.5.0)
    parallel (1.22.1)
    parser (3.1.2.1)
      ast (~> 2.4.1)
    pg (1.4.3)
    propshaft (0.6.4)
      actionpack (>= 7.0.0)
      activesupport (>= 7.0.0)
      rack
      railties (>= 7.0.0)
    pry (0.14.1)
      coderay (~> 1.1)
      method_source (~> 1.0)
    public_suffix (5.0.0)
    puma (4.3.12)
      nio4r (~> 2.0)
    racc (1.6.0)
    rack (2.2.4)
    rack-test (2.0.2)
      rack (>= 1.3)
    rails (7.0.3.1)
      actioncable (= 7.0.3.1)
      actionmailbox (= 7.0.3.1)
      actionmailer (= 7.0.3.1)
      actionpack (= 7.0.3.1)
      actiontext (= 7.0.3.1)
      actionview (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activemodel (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      bundler (>= 1.15.0)
      railties (= 7.0.3.1)
    rails-dom-testing (2.0.3)
      activesupport (>= 4.2.0)
      nokogiri (>= 1.6)
    rails-html-sanitizer (1.4.3)
      loofah (~> 2.3)
    railties (7.0.3.1)
      actionpack (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      method_source
      rake (>= 12.2)
      thor (~> 1.0)
      zeitwerk (~> 2.5)
    rainbow (3.1.1)
    rake (13.0.6)
    rb-fsevent (0.11.2)
    rb-inotify (0.10.1)
      ffi (~> 1.0)
    redis (4.8.0)
    regexp_parser (2.5.0)
    request_store (1.5.1)
      rack (>= 1.4)
    responders (3.0.1)
      actionpack (>= 5.0)
      railties (>= 5.0)
    rexml (3.2.5)
    rinku (2.0.6)
    rubocop (1.36.0)
      json (~> 2.3)
      parallel (~> 1.10)
      parser (>= 3.1.2.1)
      rainbow (>= 2.2.2, < 4.0)
      regexp_parser (>= 1.8, < 3.0)
      rexml (>= 3.2.5, < 4.0)
      rubocop-ast (>= 1.20.1, < 2.0)
      ruby-progressbar (~> 1.7)
      unicode-display_width (>= 1.4.0, < 3.0)
    rubocop-ast (1.21.0)
      parser (>= 3.1.1.0)
    rubocop-performance (1.14.3)
      rubocop (>= 1.7.0, < 2.0)
      rubocop-ast (>= 0.4.0)
    rubocop-rails (2.15.2)
      activesupport (>= 4.2.0)
      rack (>= 1.1)
      rubocop (>= 1.7.0, < 2.0)
    ruby-progressbar (1.11.0)
    ruby2_keywords (0.0.5)
    ruby_dep (1.5.0)
    rubyzip (2.3.2)
    sassc (2.4.0)
      ffi (~> 1.9)
    selenium-webdriver (4.4.0)
      childprocess (>= 0.5, < 5.0)
      rexml (~> 3.2, >= 3.2.5)
      rubyzip (>= 1.2.2, < 3.0)
      websocket (~> 1.0)
    serviceworker-rails (0.6.0)
      railties (>= 3.1)
    shellany (0.0.1)
    slim (4.1.0)
      temple (>= 0.7.6, < 0.9)
      tilt (>= 2.0.6, < 2.1)
    slim_lint (0.22.1)
      rubocop (>= 0.78.0)
      slim (>= 3.0, < 5.0)
    spring (2.1.1)
    spring-watcher-listen (2.0.1)
      listen (>= 2.7, < 4.0)
      spring (>= 1.2, < 3.0)
    streamio-ffmpeg (3.0.2)
      multi_json (~> 1.8)
    strscan (3.0.4)
    tailwindcss-rails (2.0.12)
      railties (>= 6.0.0)
    temple (0.8.2)
    thor (1.2.1)
    tilt (2.0.11)
    timeout (0.3.0)
    turbo-rails (1.1.1)
      actionpack (>= 6.0.0)
      activejob (>= 6.0.0)
      railties (>= 6.0.0)
    turbolinks (5.2.1)
      turbolinks-source (~> 5.2)
    turbolinks-source (5.2.0)
    tzinfo (2.0.5)
      concurrent-ruby (~> 1.0)
    unicode-display_width (2.2.0)
    warden (1.2.9)
      rack (>= 2.0.9)
    web-console (4.2.0)
      actionview (>= 6.0.0)
      activemodel (>= 6.0.0)
      bindex (>= 0.4.0)
      railties (>= 6.0.0)
    webdrivers (5.0.0)
      nokogiri (~> 1.6)
      rubyzip (>= 1.3.0)
      selenium-webdriver (~> 4.0)
    websocket (1.2.9)
    websocket-driver (0.7.5)
      websocket-extensions (>= 0.1.0)
    websocket-extensions (0.1.5)
    xpath (3.2.0)
      nokogiri (~> 1.8)
    zeitwerk (2.6.0)

PLATFORMS
  ruby

DEPENDENCIES
  algoliasearch-rails
  aws-sdk-rails
  aws-sdk-s3
  bootsnap (>= 1.4.2)
  byebug
  capybara (>= 2.15)
  cssbundling-rails (~> 1.1)
  devise
  font-awesome-sass (~> 6.1.1)
  gon
  gravtastic
  guard
  guard-rubocop
  hotwire-livereload (~> 1.2)
  html2slim
  http_accept_language (~> 2.1)
  jbuilder (~> 2.7)
  jsbundling-rails (~> 1.0)
  listen (>= 3.0.5, < 3.2)
  mini_magick
  pg (>= 0.18, < 2.0)
  propshaft (~> 0.6.4)
  puma (~> 4.3)
  rails (~> 7.0.0)
  redis (~> 4.0)
  rinku
  rubocop
  rubocop-performance
  rubocop-rails
  selenium-webdriver
  serviceworker-rails (~> 0.6.0)
  slim
  slim_lint
  spring
  spring-watcher-listen (~> 2.0.0)
  streamio-ffmpeg
  tailwindcss-rails (~> 2.0)
  turbo-rails (~> 1.1)
  turbolinks (~> 5)
  web-console (>= 3.3.0)
  webdrivers

RUBY VERSION
   ruby 2.7.6p219

BUNDLED WITH
   2.1.4

你能告诉我你的想法吗?

ruby-on-rails sprockets ruby-on-rails-7
2个回答
1
投票
/tmp/codon/tmp/buildpacks/50d5eddf222a9b7326028041d4e6509f915ccf2c/lib/language_pack/rails3.rb:137:in `sprocket_version_upgrade_needed': undefined method `<' for nil:NilClass (NoMethodError)

如果您使用 Heroku,Gemfile.lock 必须包含 sprockets-rails。

Heroku 默认检查 Gemfile 中的链轮版本

在您的 Gemfile.lock 导轨中应包含链轮导轨

    rails (7.0.3.1)
      actioncable (= 7.0.3.1)
      actionmailbox (= 7.0.3.1)
      actionmailer (= 7.0.3.1)
      actionpack (= 7.0.3.1)
      actiontext (= 7.0.3.1)
      actionview (= 7.0.3.1)
      activejob (= 7.0.3.1)
      activemodel (= 7.0.3.1)
      activerecord (= 7.0.3.1)
      activestorage (= 7.0.3.1)
      activesupport (= 7.0.3.1)
      bundler (>= 1.15.0)
      railties (= 7.0.3.1)

0
投票

我将此块添加到我的 Gemfile 中以修复我的 Dokku(herokuish)部署:

# Gemfile
group :dokku_deployment_fix do
  gem 'sprockets-rails'
end
© www.soinside.com 2019 - 2024. All rights reserved.