繁体   English   中英

Heroku Rails 预编译资产错误。 部署 Ruby On Rails 应用程序

[英]Heroku Rails precompiling assets error. Deploying Ruby On Rails app

我正在尝试在 Heroku 上使用 postgres 部署 Ruby On Rails 应用程序,但每次出现以下错误时:

 !     Warning: Multiple default buildpacks reported the ability to handle this app. The first buildpack in the list below will be used.
            Detected buildpacks: Ruby,Node.js
            See https://devcenter.heroku.com/articles/buildpacks#buildpack-detect-order
-----> Ruby app detected
-----> Installing bundler 1.17.3
-----> Removing BUNDLED WITH version in the Gemfile.lock
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.6.0
###### WARNING:
       There is a known bundler bug with your version of Ruby
       
       Your version of Ruby contains a problem with the built-in integration of bundler. If
       you encounter a bundler error you need to upgrade your Ruby version. We suggest you upgrade to:
       
       2.6.8
       
       For more information see:
         https://devcenter.heroku.com/articles/bundler-version#known-upgrade-issues
###### WARNING:
       Removing `Gemfile.lock` because it was generated on Windows.
       Bundler will do a full resolve so native gems are handled properly.
       This may result in unexpected gem versions being used in your app.
       In rare occasions Bundler may not be able to resolve your dependencies at all.
       
       https://devcenter.heroku.com/articles/bundler-windows-gemfile
-----> Installing dependencies using bundler 1.17.3
       Running: BUNDLE_WITHOUT='development:test' BUNDLE_PATH=vendor/bundle BUNDLE_BIN=vendor/bundle/bin BUNDLE_GLOBAL_PATH_APPENDS_RUBY_SCOPE=1 bundle install -j4
       The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
       Fetching gem metadata from https://rubygems.org/............
       Fetching gem metadata from https://rubygems.org/.
       Resolving dependencies....
       Fetching rake 13.0.6
       Installing rake 13.0.6
       Fetching concurrent-ruby 1.1.9
       Fetching zeitwerk 2.4.2
       Fetching minitest 5.14.4
       Installing zeitwerk 2.4.2
       Installing minitest 5.14.4
       Fetching builder 3.2.4
       Installing concurrent-ruby 1.1.9
       Installing builder 3.2.4
       Fetching erubi 1.10.0
       Installing erubi 1.10.0
       Fetching mini_portile2 2.6.1
       Fetching racc 1.5.2
       Installing mini_portile2 2.6.1
       Installing racc 1.5.2 with native extensions
       Fetching crass 1.0.6
       Installing crass 1.0.6
       Fetching rack 2.2.3
       Installing rack 2.2.3
       Fetching nio4r 2.5.8
       Fetching websocket-extensions 0.1.5
       Installing nio4r 2.5.8 with native extensions
       Installing websocket-extensions 0.1.5
       Fetching marcel 1.0.1
       Installing marcel 1.0.1
       Fetching mini_mime 1.1.1
       Installing mini_mime 1.1.1
       Fetching ffi 1.15.4
       Installing ffi 1.15.4 with native extensions
       Fetching bcrypt 3.1.16
       Installing bcrypt 3.1.16 with native extensions
       Fetching msgpack 1.4.2
       Installing msgpack 1.4.2 with native extensions
       Using bundler 1.17.3
       Fetching method_source 1.0.0
       Installing method_source 1.0.0
       Fetching thor 1.1.0
       Installing thor 1.1.0
       Fetching pg 1.2.3
       Installing pg 1.2.3 with native extensions
       Fetching tilt 2.0.10
       Installing tilt 2.0.10
       Fetching semantic_range 3.0.0
       Installing semantic_range 3.0.0
       Fetching turbolinks-source 5.2.0
       Installing turbolinks-source 5.2.0
       Fetching i18n 1.8.10
       Installing i18n 1.8.10
       Fetching tzinfo 2.0.4
       Installing tzinfo 2.0.4
       Fetching rack-test 1.1.0
       Installing rack-test 1.1.0
       Fetching rack-proxy 0.7.0
       Installing rack-proxy 0.7.0
       Fetching sprockets 4.0.2
       Installing sprockets 4.0.2
       Fetching websocket-driver 0.7.5
       Installing websocket-driver 0.7.5 with native extensions
       Fetching mail 2.7.1
       Installing mail 2.7.1
       Fetching nokogiri 1.12.4 (x86_64-linux)
       Installing nokogiri 1.12.4 (x86_64-linux)
       Fetching puma 5.4.0
       Installing puma 5.4.0 with native extensions
       Fetching ffi-compiler 1.0.1
       Installing ffi-compiler 1.0.1
       Fetching sassc 2.4.0
       Installing sassc 2.4.0 with native extensions
       Fetching turbolinks 5.2.1
       Installing turbolinks 5.2.1
       Fetching activesupport 6.1.4.1
       Installing activesupport 6.1.4.1
       Fetching bootsnap 1.8.1
       Installing bootsnap 1.8.1 with native extensions
       Fetching loofah 2.12.0
       Installing loofah 2.12.0
       Fetching argon2 2.0.3
       Installing argon2 2.0.3 with native extensions
       Fetching rails-dom-testing 2.0.3
       Installing rails-dom-testing 2.0.3
       Fetching globalid 0.5.2
       Installing globalid 0.5.2
       Fetching activemodel 6.1.4.1
       Installing activemodel 6.1.4.1
       Fetching jbuilder 2.11.2
       Installing jbuilder 2.11.2
       Fetching rails-html-sanitizer 1.4.2
       Installing rails-html-sanitizer 1.4.2
       Fetching activejob 6.1.4.1
       Installing activejob 6.1.4.1
       Fetching activerecord 6.1.4.1
       Installing activerecord 6.1.4.1
       Fetching email_validator 2.2.3
       Installing email_validator 2.2.3
       Fetching actionview 6.1.4.1
       Installing actionview 6.1.4.1
       Fetching actionpack 6.1.4.1
       Installing actionpack 6.1.4.1
       Fetching activestorage 6.1.4.1
       Fetching actioncable 6.1.4.1
       Installing activestorage 6.1.4.1
       Installing actioncable 6.1.4.1
       Fetching actionmailer 6.1.4.1
       Installing actionmailer 6.1.4.1
       Fetching railties 6.1.4.1
       Fetching sprockets-rails 3.2.2
       Installing railties 6.1.4.1
       Installing sprockets-rails 3.2.2
       Fetching actionmailbox 6.1.4.1
       Installing actionmailbox 6.1.4.1
       Fetching actiontext 6.1.4.1
       Installing actiontext 6.1.4.1
       Fetching rails 6.1.4.1
       Fetching sassc-rails 2.1.2
       Installing rails 6.1.4.1
       Installing sassc-rails 2.1.2
       Fetching webpacker 5.4.2
       Fetching clearance 2.4.0
       Installing clearance 2.4.0
       Installing webpacker 5.4.2
       Fetching sass-rails 6.0.0
       Installing sass-rails 6.0.0
       Bundle complete! 18 Gemfile dependencies, 62 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into `./vendor/bundle`
       Bundle completed (202.76s)
       Cleaning up the bundler cache.
       The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
-----> Installing node-v12.16.2-linux-x64
-----> Installing yarn-v1.22.4
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       yarn install v1.22.4
       info No lockfile found.
       [1/4] Resolving packages...
       [2/4] Fetching packages...
       [3/4] Linking dependencies...
       [4/4] Building fresh packages...
       Done in 0.98s.
       rake aborted!
       Sprockets::ArgumentError: link_tree argument must be a directory
       /tmp/build_0d398ac2/app/assets/config/manifest.js:1
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:389:in `expand_relative_dirname'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:341:in `process_link_tree_directive'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:189:in `block in process_directives'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:187:in `each'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:187:in `process_directives'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:84:in `_call'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/directive_processor.rb:65:in `call'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/bundle.rb:27:in `call'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:84:in `call_processor'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:66:in `block in call_processors'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `reverse_each'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/processor_utils.rb:65:in `call_processors'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:182:in `load_from_unloaded'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:59:in `block in load'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:337:in `fetch_asset_from_dependency_cache'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/loader.rb:43:in `load'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/cached_environment.rb:44:in `load'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:81:in `find_asset'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/base.rb:88:in `find_all_linked_assets'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/sprockets-4.0.2/lib/sprockets/manifest.rb:125:in `block (2 levels) in find'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:24:in `block in execute'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `block in synchronize'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/synchronization/mutex_lockable_object.rb:47:in `synchronize'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/safe_task_executor.rb:19:in `execute'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/promise.rb:564:in `block in realize'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:363:in `run_task'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:352:in `block (3 levels) in create_worker'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `loop'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:335:in `block (2 levels) in create_worker'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `catch'
       /tmp/build_0d398ac2/vendor/bundle/ruby/2.6.0/gems/concurrent-ruby-1.1.9/lib/concurrent-ruby/concurrent/executor/ruby_thread_pool_executor.rb:334:in `block in create_worker'
       Tasks: TOP => assets:precompile
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

..................................................... ..................................................... ..................................................... …………………………………………………………………………

任何帮助都是适当的。 如果需要,我可以显示 .rb 文件的代码。

此行中描述了该问题:

ArgumentError:link_tree 参数必须是目录 /tmp/build_0d398ac2/app/assets/config/manifest.js:1

在新的 Rails 应用程序中, manifest.js文件包含以下行:

//= link_tree ../images

如果您的app/assets/images目录没有 Git 跟踪的.keep文件,Heroku 就无法将其识别为目录。

这通常发生在您使用--skip-keeps选项创建 Rails 应用程序时,或者当您将*.keep文件添加到您的.gitignore文件时忽略它们。

要修复它,您需要生成该.keep文件,确保它被 Git 跟踪,然后再次尝试部署。

希望这可以帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM