【问题标题】:Unable to push into heroku master-rake aborted?无法推入 heroku master-rake 中止?
【发布时间】:2014-01-20 16:15:56
【问题描述】:

我已经把我的代码放在github 但是当我推送到heroku

错误:-

rake aborted!
   couldn't find file 'twitter/bootstrap'
   (in /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/app/assets/javascript
s/application.js:15)
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/context.rb:106:in `resolve'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/context.rb:146:in `require_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/directive_processor.rb:217:in`process_requi
re_directive'
/tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/directive_processor.rb:167:in `block in  process_directives'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/directive_processor.rb:165:in `each'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/directive_processor.rb:165:in `process_directives'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/directive_processor.rb:99:in `evaluate'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/tilt-1.4.1/lib/tilt/template.rb:103:in `render'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/context.rb:197:in `block in evaluate'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/context.rb:194:in `each'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/context.rb:194:in `evaluate'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/processed_asset.rb:12:in `initialize'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:374:in `new'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:374:in `block in build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:395:in `circular_call_protection'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:373:in `build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/bundled_asset.rb:16:in `initialize'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:377:in `new'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:377:in `build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/index.rb:94:in `block in build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/caching.rb:58:in `cache_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/index.rb:93:in `build_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/base.rb:287:in `find_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/index.rb:61:in `find_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/manifest.rb:211:in `block in find_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/manifest.rb:257:in `benchmark'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/manifest.rb:210:in `find_asset'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/manifest.rb:119:in `block in compile'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/manifest.rb:118:in `each'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/sprockets/manifest.rb:118:in `compile'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:60:in `block (3 levels) i
n define'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-2.10.1/lib/rake/sprocketstask.rb:146:in `with_logger'
   /tmp/build_84917108-19fa-4e88-8644-70f8ceccdb4f/vendor/bundle/ruby/2.0.0/
gems/sprockets-rails-2.0.1/lib/sprockets/rails/task.rb:59:in `block (2   levels) i
n define'
   Tasks: TOP => assets:precompile
   (See full trace by running task with --trace)
 !
 !     Precompiling assets failed.
 !

 !     Push rejected, failed to compile Ruby app

To git@heroku.com:sheltered-ravine-2545.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git@heroku.com:sheltered-ravine-2545.git'`

当我添加gem twitter-bootstrap-rails 时,它显示不同的错误,因为我正在处理windows,其中sass 无法加载。

我的 gem 文件

source 'https://rubygems.org'
gem 'rails', '4.0.0'
gem 'pg'
gem 'sass-rails', '~> 4.0.0'
gem 'protected_attributes'


gem 'uglifier', '>= 1.3.0'


gem 'coffee-rails', '~> 4.0.0'
gem "devise", "~> 3.2.2"
gem "highcharts-rails", "~> 3.0.7"



gem 'jquery-rails'


gem 'turbolinks'


gem 'jbuilder', '~> 1.2'

group :doc do
gem 'sdoc', require: false
end

在我的 applicaition.js

 // This is a manifest file that'll be compiled into application.js, which will include all the files
 // listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// Read Sprockets README (https://github.com/sstephenson/sprockets#sprockets-directives) for details
// about supported directives.
//
//= require jquery
//= require jquery_ujs
//= require twitter/bootstrap
//= require turbolinks
//= require_tree .

【问题讨论】:

  • 你能发布你的 application.js 文件吗?
  • 我已经添加了application.js。我的代码在 git 上。
  • 我想我应该删除//=twitter/bootstrap.?

标签: ruby-on-rails ruby git twitter-bootstrap heroku


【解决方案1】:

您的 application.js 文件需要一个名为 bootstrap.js 的文件,该文件位于名为 twitter 的文件夹中,其中包含以下行:

//= require twitter/bootstrap

所以,添加所需的文件,bootstrap.jsvendor/assets/javascripts/twitter/


或者,如果您不希望该文件作为应用程序的一部分,只需删除需要它的行。

【讨论】:

    【解决方案2】:

    在运行 bundle install 之后,你是否运行了生成器?

    rails generate bootstrap:install static

    【讨论】:

    • 这些是官方网站 (twbs.github.io/bootstrap) 上安装 twitter-bootstrap-rails gem 的说明 将 gem 放入 gemfile,运行 bundle install 然后运行生成器。
    猜你喜欢
    • 1970-01-01
    • 2012-07-11
    • 2011-08-03
    • 1970-01-01
    • 2014-04-01
    • 1970-01-01
    • 1970-01-01
    • 2011-10-24
    • 2014-07-10
    相关资源
    最近更新 更多