0

我是 Rails 的新手,我正在用 3.2.0 开发一些应用程序。所以,一切都很好,它适用于我的本地环境,但是当我尝试将它推送到 Heroku 时,资产出现问题 - 我的 css 文件没有编译成一个 application.css 文件,因此我的最终 application.css 是干净的(您可以通过在 Heroku 上链接我的应用程序来查看它)。我的本地机器上没有问题。我在 Google 中找到了一些答案,建议人们执行以下命令:

RAILS_ENV=production bundle exec rake assets:precompile

我尝试这样做并得到以下输出:

/Users/marya/.rvm/rubies/ruby-1.9.3-p448/bin/ruby: No such file or directory -- ruby /Users/marya/.rvm/gems/ruby-1.9.3-p448@global/bin/rake assets:precompile (LoadError)
rake aborted!
Command failed with status (1): [/Users/marya/.rvm/rubies/ruby-1.9.3-p448/b...]
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.0/lib/sprockets/assets.rake:9:in `ruby_rake_task'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.0/lib/sprockets/assets.rake:17:in `invoke_or_reboot_rake_task'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/gems/actionpack-3.2.0/lib/sprockets/assets.rake:25:in `block (2 levels) in <top (required)>'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:14:in `eval'
/Users/marya/.rvm/gems/ruby-1.9.3-p448/bin/ruby_executable_hooks:14:in `<main>'
Tasks: TOP => assets:precompile
(See full trace by running task with --trace)

我不明白它是什么意思,所以我需要你的帮助。我的宝石文件:

source 'https://rubygems.org'

gem 'rails', '3.2.0'
gem 'bootstrap-sass', '2.1'
gem 'bcrypt-ruby', '3.0.1'
gem 'faker', '1.0.1'
gem 'will_paginate', '3.0.3'
gem 'bootstrap-will_paginate', '0.0.6'
# Bundle edge Rails instead:
# gem 'rails', :git => 'git://github.com/rails/rails.git'
group :development, :test do
  gem 'sqlite3', '1.3.5'
  gem 'rspec-rails', '2.11.0'
end

# Gems used only for assets and not required
# in production environments by default.
group :assets do
  gem 'sass-rails',   '3.2.5'
  gem 'coffee-rails', '3.2.2'

  # See https://github.com/sstephenson/execjs#readme for more supported runtimes
  # gem 'therubyracer'

  gem 'uglifier', '1.2.3'
end

gem 'jquery-rails', '2.0.2'

group :test do
  gem 'capybara', '1.1.2'
  gem 'factory_girl_rails', '4.1.0'
end

group :production do
  gem 'pg', '0.12.2'
  gem 'rails_12factor'
end
# To use ActiveModel has_secure_password
# gem 'bcrypt-ruby', '~> 3.0.0'

# To use Jbuilder templates for JSON
# gem 'jbuilder'

# Use unicorn as the web server
# gem 'unicorn'

# Deploy with Capistrano
# gem 'capistrano'

# To use debugger
# gem 'ruby-debug19', :require => 'ruby-debug'

如果您需要其他项目文件,请告诉我,我会做的。提前致谢!

4

1 回答 1

-1

似乎是一个 RVM 怪癖。我使用 rvm + ruby​​ 2.0.0-p247 遇到了这个问题,这对我有用:

rvm ruby-2.0.0-p247@global do gem install executable-hooks
于 2013-10-04T23:11:12.993 回答