2

我正在关注优秀的 Michael Hartl Rails 书(Rails 3.2),但在尝试运行命令时出现错误:

rake assets:precompile

错误如下:

/Users/Jamie/.rvm/rubies/ruby-1.9.3-p448/bin/ruby ruby /Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/bin/rake assets:precompile assets:precompile:all RAILS_ENV=production RAILS_GROUPS=assets
/Users/Jamie/.rvm/rubies/ruby-1.9.3-p448/bin/ruby: No such file or directory -- ruby /Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/bin/rake assets:precompile (LoadError)
rake aborted!
Command failed with status (1): [/Users/Jamie/.rvm/rubies/ruby-1.9.3-p448/b...]
/Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/gems/actionpack-    3.2.14/lib/sprockets/assets.rake:12:in `ruby_rake_task'
/Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/gems/actionpack-3.2.14/lib/sprockets/assets.rake:21:in `invoke_or_reboot_rake_task'
/Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/gems/actionpack-3.2.14/lib/sprockets/assets.rake:29:in `block (2 levels) in <top (required)>'
/Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/bin/ruby_executable_hooks:14:in `eval'
/Users/Jamie/.rvm/gems/ruby-1.9.3-p448@movies/bin/ruby_executable_hooks:14:in `<main>'
Tasks: TOP => assets:precompile

谢谢你的帮助!

4

3 回答 3

2

我试图在 ubuntu 中运行 rake 命令,但遇到了 ruby​​_executable_hooks 错误。我解决了它:

rvm all do gem install executable-hooks
于 2013-11-27T17:20:17.473 回答
2

我通过从 p448 恢复到 p392 然后运行来解决这个问题:

rvm ruby-1.9.3-p392@global do gem install executable-hooks

正如mpapis在这里所建议的那样:Rake assets:precompile cannot find ruby

于 2013-09-24T08:41:01.787 回答
0

这似乎是 1.9.3-p448 的问题。今天我将服务器上的 ruby​​ 从 p392 更新为 p448 并开始出现此错误。我恢复到 p392 并且资产的预编译再次工作。

也许尝试安装 p448 之前的版本,然后重试。

在处理了更多之后,我发现清空并重新安装我的 gem 导致预编译重新开始工作:

$ rvm gemset empty
$ bundle install
$ rake assets:precompile RAILS_ENV=production
于 2013-09-23T20:24:51.553 回答