1

当我将我的 ruby​​ on rails 应用程序推送到 heroku 时,所有图像都不会加载。

我试图预编译所有资产,但出现此错误:

jack:my_first_ruby_app Jack$ bundle exec rake assets:precompile
rake aborted!
/Users/Jack/Sites/my_first_ruby_app/Rakefile:1: unknown regexp option - b
/Users/Jack/Sites/my_first_ruby_app/Rakefile:1: syntax error, unexpected tIDENTIFIER,     expecting keyword_do or '{' or '('
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/rake_module.rb:25:in `load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:589:in `raw_load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:89:in `block in load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:88:in `load_rakefile'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:72:in `block in run'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:160:in `standard_exception_handling'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195@global/gems/rake-10.0.4/lib/rake/application.rb:70:in `run'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `eval'
/Users/Jack/.rvm/gems/ruby-2.0.0-p195/bin/ruby_noexec_wrapper:14:in `<main>'

Rakefile 的内容:

/usr/bin/env rake
# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)

MyFirstRubyApp::Application.load_tasks

Ruby 2.0.0p195 版本

4

1 回答 1

6

请编辑您的Rakefile

并评论了第 1 行

像这样

#!/usr/bin/env rake

于 2013-06-18T06:09:10.303 回答