【问题标题】:"Precompiling assets failed" when pushing a Rails app to Heroku将 Rails 应用程序推送到 Heroku 时出现“预编译资产失败”
【发布时间】:2018-10-31 22:22:26
【问题描述】:

我正在学习 Ruby on Rails 课程,并且正在尝试将应用程序推送到 Heroku。我已经搜索过有关同一问题的旧 StackOverflow 帖子,但这些建议都不适合我。以下是我尝试的日志。我将不胜感激任何帮助。谢谢。

我被告知要添加更多文字。主要错误似乎是:

“预编译资产失败”

“预接收挂钩被拒绝”

ID 52540144-6b6d-4959-95a0-b9350d45a774
 !     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
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.5.1
-----> Installing dependencies using bundler 1.15.2
       Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
       Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.5). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       Fetching gem metadata from https://rubygems.org/.........
       Fetching version metadata from https://rubygems.org/..
       Fetching dependency metadata from https://rubygems.org/.
       Fetching rake 12.3.1
       Fetching concurrent-ruby 1.0.5
       Fetching minitest 5.11.3
       Installing minitest 5.11.3
       Installing concurrent-ruby 1.0.5
       Installing rake 12.3.1
       Fetching thread_safe 0.3.6
       Installing thread_safe 0.3.6
       Fetching builder 3.2.3
       Installing builder 3.2.3
       Fetching erubi 1.7.1
       Installing erubi 1.7.1
       Fetching mini_portile2 2.3.0
       Installing mini_portile2 2.3.0
       Fetching crass 1.0.4
       Installing crass 1.0.4
       Fetching rack 2.0.5
       Fetching nio4r 2.3.1
       Installing nio4r 2.3.1 with native extensions
       Installing rack 2.0.5
       Fetching websocket-extensions 0.1.3
       Installing websocket-extensions 0.1.3
       Fetching mini_mime 1.0.1
       Installing mini_mime 1.0.1
       Fetching arel 9.0.0
       Installing arel 9.0.0
       Fetching mimemagic 0.3.2
       Fetching execjs 2.7.0
       Installing execjs 2.7.0
       Fetching msgpack 1.2.4
       Installing mimemagic 0.3.2
       Installing msgpack 1.2.4 with native extensions
       Fetching popper_js 1.14.3
       Installing popper_js 1.14.3
       Fetching rb-fsevent 0.10.3
       Installing rb-fsevent 0.10.3
       Fetching ffi 1.9.25
       Installing ffi 1.9.25 with native extensions
       Using bundler 1.15.2
       Fetching coffee-script-source 1.12.2
       Installing coffee-script-source 1.12.2
       Fetching method_source 0.9.0
       Installing method_source 0.9.0
       Fetching thor 0.20.0
       Installing thor 0.20.0
       Fetching multi_json 1.13.1
       Installing multi_json 1.13.1
       Fetching pg 1.1.3
       Installing pg 1.1.3 with native extensions
       Fetching puma 3.12.0
       Installing puma 3.12.0 with native extensions
       Fetching tilt 2.0.8
       Installing tilt 2.0.8
       Fetching turbolinks-source 5.2.0
       Installing turbolinks-source 5.2.0
       Fetching tzinfo 1.2.5
       Installing tzinfo 1.2.5
       Fetching i18n 1.1.1
       Installing i18n 1.1.1
       Fetching nokogiri 1.8.5
       Installing nokogiri 1.8.5 with native extensions
       Fetching websocket-driver 0.7.0
       Installing websocket-driver 0.7.0 with native extensions
       Fetching mail 2.7.1
       Installing mail 2.7.1
       Fetching rack-test 1.1.0
       Installing rack-test 1.1.0
       Fetching sprockets 3.7.2
       Installing sprockets 3.7.2
       Fetching autoprefixer-rails 9.3.1
       Installing autoprefixer-rails 9.3.1
       Fetching uglifier 4.1.19
       Installing uglifier 4.1.19
       Fetching marcel 0.3.3
       Installing marcel 0.3.3
       Fetching coffee-script 2.4.1
       Installing coffee-script 2.4.1
       Fetching bootsnap 1.3.2
       Installing bootsnap 1.3.2 with native extensions
       Fetching rb-inotify 0.9.10
       Installing rb-inotify 0.9.10
       Fetching turbolinks 5.2.0
       Installing turbolinks 5.2.0
       Fetching activesupport 5.2.1
       Installing activesupport 5.2.1
       Fetching loofah 2.2.3
       Installing loofah 2.2.3
       Fetching sass-listen 4.0.0
       Installing sass-listen 4.0.0
       Fetching rails-dom-testing 2.0.3
       Installing rails-dom-testing 2.0.3
       Fetching globalid 0.4.1
       Installing globalid 0.4.1
       Fetching activemodel 5.2.1
       Fetching jbuilder 2.7.0
       Installing activemodel 5.2.1
       Installing jbuilder 2.7.0
       Fetching rails-html-sanitizer 1.0.4
       Installing rails-html-sanitizer 1.0.4
       Fetching sass 3.6.0
       Fetching activejob 5.2.1
       Installing activejob 5.2.1
       Installing sass 3.6.0
       Fetching activerecord 5.2.1
       Fetching actionview 5.2.1
       Installing activerecord 5.2.1
       Installing actionview 5.2.1
       Fetching actionpack 5.2.1
       Installing actionpack 5.2.1
       Fetching bootstrap 4.1.3
       Installing bootstrap 4.1.3
       Fetching bootstrap-sass 3.3.7
       Installing bootstrap-sass 3.3.7
       Fetching actioncable 5.2.1
       Installing actioncable 5.2.1
       Fetching actionmailer 5.2.1
       Installing actionmailer 5.2.1
       Fetching activestorage 5.2.1
       Installing activestorage 5.2.1
       Fetching railties 5.2.1
       Installing railties 5.2.1
       Fetching sprockets-rails 3.2.1
       Installing sprockets-rails 3.2.1
       Fetching jquery-rails 4.3.3
       Fetching coffee-rails 4.2.2
       Fetching rails 5.2.1
       Installing coffee-rails 4.2.2
       Installing rails 5.2.1
       Fetching sass-rails 5.0.7
       Installing sass-rails 5.0.7
       Installing jquery-rails 4.3.3
       Bundle complete! 19 Gemfile dependencies, 66 gems now installed.
       Gems in the groups development and test were not installed.
       Bundled gems are installed into ./vendor/bundle.
       Post-install message from sass:

       Ruby Sass is deprecated and will be unmaintained as of 26 March 2019.

       * If you use Sass as a command-line tool, we recommend using Dart Sass, the new
         primary implementation: https://sass-lang.com/install

       * If you use Sass as a plug-in for a Ruby web framework, we recommend using the
         sassc gem: https://github.com/sass/sassc-ruby#readme

       * For more details, please refer to the Sass blog:
         http://sass.logdown.com/posts/7081811

       Bundle completed (47.12s)
       Cleaning up the bundler cache.
       Warning: the running version of Bundler (1.15.2) is older than the version that created the lockfile (1.16.5). We suggest you upgrade to the latest version of Bundler by running `gem install bundler`.
       The latest bundler is 1.17.1, but you are currently running 1.15.2.
       To update, run `gem install bundler`
-----> Installing node-v8.10.0-linux-x64
-----> Detecting rake tasks
-----> Preparing app for Rails asset pipeline
       Running: rake assets:precompile
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-sass-3.3.7/lib/bootstrap-sass/version.rb:2: warning: already initialized constant Bootstrap::VERSION
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.1.3/lib/bootstrap/version.rb:2: warning: previous definition of VERSION was here
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-sass-3.3.7/lib/bootstrap-sass/version.rb:3: warning: already initialized constant Bootstrap::BOOTSTRAP_SHA
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.1.3/lib/bootstrap/version.rb:3: warning: previous definition of BOOTSTRAP_SHA was here
       Yarn executable was not detected in the system.
       Download Yarn at https://yarnpkg.com/en/docs/install
       I, [2018-10-31T14:05:58.213666 #1419]  INFO -- : Writing /tmp/build_d87edff4795e58683aa5e3626de5a3f7/public/assets/bicycle-b0065f34bb7db6b7b0a5cf8d177e85276f69b39e791b5fd72a245e8b90e0cc43.jpg
       I, [2018-10-31T14:06:05.048362 #1419]  INFO -- : Writing /tmp/build_d87edff4795e58683aa5e3626de5a3f7/public/assets/application-b2b98178b68108062edcf84d640b496d914a3dab78c660f799ab4c8a54064fcd.js
       I, [2018-10-31T14:06:05.048648 #1419]  INFO -- : Writing /tmp/build_d87edff4795e58683aa5e3626de5a3f7/public/assets/application-b2b98178b68108062edcf84d640b496d914a3dab78c660f799ab4c8a54064fcd.js.gz
       rake aborted!
       Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets.
       Load paths:
         /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.1.3/assets/stylesheets
         /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.1.3/assets/stylesheets
       (sass):1
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:67:in `rescue in import'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:44:in `import'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:28:in `imported_file'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:37:in `css_import?'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:310:in `visit_import'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:36:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/stack.rb:79:in `block in with_base'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/stack.rb:135:in `with_frame'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/stack.rb:79:in `with_base'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:158:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:52:in `map'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:52:in `visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:36:in `block in visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:36:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:157:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:10:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/root_node.rb:36:in `css_tree'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/root_node.rb:20:in `render'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/engine.rb:290:in `render'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_compressor.rb:48:in `call'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_compressor.rb:28:in `call'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'

       Caused by:
       Sass::SyntaxError: File to import not found or unreadable: bootstrap-sprockets.
       Load paths:
         /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.1.3/assets/stylesheets
         /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/bootstrap-4.1.3/assets/stylesheets
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:65:in `import'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:28:in `imported_file'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/import_node.rb:37:in `css_import?'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:310:in `visit_import'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:36:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:158:in `block in visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/stack.rb:79:in `block in with_base'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/stack.rb:135:in `with_frame'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/stack.rb:79:in `with_base'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:158:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:52:in `block in visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:52:in `map'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:52:in `visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:167:in `block in visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:179:in `with_environment'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:166:in `visit_children'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:36:in `block in visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:186:in `visit_root'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/base.rb:36:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:157:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/visitors/perform.rb:10:in `visit'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/root_node.rb:36:in `css_tree'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/tree/root_node.rb:20:in `render'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sass-3.6.0/lib/sass/engine.rb:290:in `render'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_compressor.rb:48:in `call'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/sass_compressor.rb:28:in `call'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:75:in `call_processor'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:57:in `block in call_processors'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `reverse_each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/processor_utils.rb:56:in `call_processors'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:134:in `load_from_unloaded'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:60:in `block in load'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:317:in `fetch_asset_from_dependency_cache'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/loader.rb:44:in `load'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:20:in `block in initialize'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/cached_environment.rb:47:in `load'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:66:in `find_asset'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/base.rb:73:in `find_all_linked_assets'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:142:in `block in find'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:114:in `block (2 levels) in logical_paths'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:228:in `block in stat_tree'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:212:in `block in stat_directory'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:209:in `stat_directory'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/path_utils.rb:227:in `stat_tree'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:105:in `block in logical_paths'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `each'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/legacy.rb:104:in `logical_paths'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:140:in `find'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/sprockets/manifest.rb:186:in `compile'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:68:in `block (3 levels) in define'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-3.7.2/lib/rake/sprocketstask.rb:147:in `with_logger'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/sprockets-rails-3.2.1/lib/sprockets/rails/task.rb:67:in `block (2 levels) in define'
       /tmp/build_d87edff4795e58683aa5e3626de5a3f7/vendor/bundle/ruby/2.5.0/gems/rake-12.3.1/exe/rake:27:in `<top (required)>'
       Tasks: TOP => assets:precompile
       (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !
 !     Push rejected, failed to compile Ruby app.
 !     Push failed

【问题讨论】:

    标签: ruby-on-rails heroku


    【解决方案1】:

    Rails 2.0+


    这是因为您使用的是bootstrap-sprockets,但没有安装bootstrap-sass gem。

    基本上将以下内容添加到您的 Gemfile 中:

    gem 'bootstrap-sass', '~> 3.3.7'
    gem 'sass-rails', '>= 3.2'
    

    然后将变量导入你的app/assets/stylesheets/application.scss:

    // "bootstrap-sprockets" must be imported before "bootstrap" and "bootstrap/variables"
    @import "bootstrap-sprockets";
    @import "bootstrap";
    

    最后,如果您使用的是scss,则需要将所有*= require_self*= require_tree 更改为@import 才能导入Sass 文件。您可以在此处找到更详细的安装说明:https://github.com/twbs/bootstrap-sass

    Rails 4.0+


    对于较新版本的 Rails,请遵循以下文档:https://github.com/twbs/bootstrap-rubygem#a-ruby-on-rails

    1. gem 'bootstrap', '~&gt; 4.1.3' 添加到您的 Gemfile 中
    2. @import "bootstrap"; 添加到您的app/assets/stylesheets/application.scss
    3. 从 Sass 文件中删除所有 *= require*= require_tree 语句,改为使用 @import
    4. gem 'jquery-rails' 添加到您的 Gemfile 中

    【讨论】:

    • 感谢您的回复,我将这些 gem 添加到 gemfile 中,但收到一个错误,提示 sass rails 3.2 和 gem 'sass-rails', '~> 5.0' 之间存在冲突同样的文件,所以我删除了 5.0 行。我试图再次推送到 Heroku,但得到了同样的结果。日志太长不能贴,但底部是这样的:remote: ! Push 拒绝到 wicked-barrow-70229。远程:致git.heroku.com/wicked-barrow-70229.git! [remote denied] master -> master (pre-receive hook denied) 错误:未能将一些 refs 推送到 'git.heroku.com/wicked-barrow-70229.git'
    • 不,不要删除5.0行!如果您使用的是新版本的 rails,请遵循此文档:github.com/twbs/bootstrap-rubygem#a-ruby-on-rails 并撤消我之前建议的更改。
    • 如果我有 application.css 而不是 application.scss,这是否会发生任何变化?
    • 是的,有一些重要的变化。您需要将您的application.css 更改为application.scss,并删除*= require*= require_tree,就像在第3 步中一样。
    • 我将 application.css 重命名为 application.scss,删除了 *=requireds,添加了 @import "bootstrap";到application.scss的顶部,当我尝试捆绑安装时收到以下错误(我认为每当我更新gemfile时都需要捆绑安装)_________________________________________________________解析Gemfile时出错:您不能指定相同gem 两次具有不同的版本要求。您指定:sass-rails (>= 3.2) 和 sass-rails (~> 5.0)。 Bundler 无法继续。
    猜你喜欢
    • 1970-01-01
    • 2021-08-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-01-13
    • 1970-01-01
    相关资源
    最近更新 更多