0

我在 rails 3.2 中预编译资产管道时不断收到错误消息。我在 rake assets:precompile 中看到的内容如下。

2012-05-02T00:47:08+00:00 app[web.1]: => Rails 3.2.3 application starting in production on http://0.0.0.0:3847
2012-05-02T00:47:08+00:00 app[web.1]: => Call with -d to detach
c:/Ruby193/bin/rake:32:in `<main>'
c:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:45:in `call'
c:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:45:in `sh'
c:/Ruby193/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `sh'
c:/Ruby193/lib/ruby/1.9.1/rake/file_utils.rb:80:in `ruby'
c:/Ruby193/lib/ruby/1.9.1/rake/file_utils_ext.rb:39:in `ruby'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/sprockets/assets.rake:12:in `ruby_rake_task'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
c:/Ruby193/lib/ruby/gems/1.9.1/gems/actionpack-3.2.3/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `call'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:205:in `block in execute'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `each'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:200:in `execute'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:158:in `block in invoke_with_call_chain'
c:/Ruby193/lib/ruby/1.9.1/monitor.rb:211:in `mon_synchronize'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:151:in `invoke_with_call_chain'
c:/Ruby193/lib/ruby/1.9.1/rake/task.rb:144:in `invoke'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:116:in `invoke_task'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block (2 levels) in top_level'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `each'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:94:in `block in top_level'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:88:in `top_level'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:66:in `block in run'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:133:in `standard_exception_handling'
c:/Ruby193/lib/ruby/1.9.1/rake/application.rb:63:in `run'
c:/Ruby193/bin/rake:32:in `<main>'
Tasks: TOP => assets:precompile

我的 application.css 和 .js 分别有以下内容;.css

>*= require overcast
>* =require jqgrid
>*= require_self
>*= require_tree .

.js

>//= require jquery
>//= require jquery_ujs
>//= require jquery-ui
>//= require jqgrid-ja
>//= require bootstrap
>//= require_directory .

我的宝石文件

source 'https://rubygems.org'

gem 'rails', '3.2.3'
gem 'bootstrap-sass', '2.0.2'
gem 'bcrypt-ruby', '3.0.1'

# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'

group :development, :test do
#  gem 'sqlite3', '1.3.5'
  gem 'pg', '0.12.2'
  gem 'rspec-rails', '2.9.0'
  gem 'guard-rspec', '0.5.5'
  gem 'annotate', '~> 2.4.1.beta'
end
group :test do
  gem 'rspec-rails', '2.9.0'
  gem 'capybara', '1.1.2'
  gem 'guard-spork', '0.3.2'
  gem 'spork', '0.9.0'
  gem 'factory_girl_rails', '1.4.0'
  gem 'cucumber-rails', '1.2.1', require: false
  gem 'database_cleaner', '0.7.0'
end
group :production do
  gem 'pg', '0.12.2'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.4'
  gem 'coffee-rails', '3.2.2'
  gem 'uglifier', '1.2.3'
  gem "rails-asset-jqueryui"
  gem "rails-asset-jqgrid"
end

gem 'jquery-rails', '2.0.0'

有人知道为什么我不能成功预编译吗?

4

1 回答 1

0

将 rake 添加到您的 gemfile。Ruby 的 stdlib 包含一个旧版本的 rake。

gem 'rake', '~> 0.9.2'

调用 rake withbundle exec以确保使用正确的版本。

bundle exec rake assets:precompile
于 2012-05-09T21:11:12.897 回答