我用 rails 创建了一个小项目并添加了 requirejs-rails gem。我已根据需要进行了设置,并且在运行 assets:precompile 时,当 requirejs-rails 尝试编译 javascript 资源时它会失败。然而,奇怪的是,assets:precompile 在调试模式下似乎可以工作。不幸的是,我需要它以非调试模式运行,以便它可以正确部署在 Heroku 上。下面是错误和堆栈跟踪。有人遇到过这个吗?更重要的是,有什么解决办法吗?
/home/whyves/.rvm/rubies/ruby-2.1.2/bin/ruby -e $stdout.sync=true;$stderr.sync=true;load($0=ARGV.shift) /home/whyves/RubymineProjects/test2/bin/spring rake --trace assets:precompile
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke requirejs:precompile:external (first_time)
** Invoke requirejs:test_node (first_time)
** Execute requirejs:test_node
** Execute requirejs:precompile:external
/home/whyves/.rvm/rubies/ruby-2.1.2/bin/ruby rake --trace assets:precompile requirejs:precompile:all RAILS_ENV=production RAILS_GROUPS=assets --trace
/home/whyves/.rvm/rubies/ruby-2.1.2/bin/ruby: No such file or directory -- rake --trace assets:precompile (LoadError)
rake aborted!
Command failed with status (1): [/home/whyves/.rvm/rubies/ruby-2.1.2/bin/ru...]
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/file_utils.rb:54:in
块在 create_shell_runner' /home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/file_utils.rb:45:in call'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/file_utils.rb:45:in
sh' /home/whyves/.rvm/gems /ruby-2.1.2/gems/rake-10.3.2/lib/rake/file_utils_ext.rb:37:in sh'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/file_utils.rb:82:in
ruby' /home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3。 2/lib/rake/file_utils_ext.rb:37:in ruby'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/requirejs-rails-0.9.3/lib/tasks/requirejs-rails_tasks.rake:19:in
ruby_rake_task' /home/whyves/.rvm/gems/ruby-2.1.2/gems/requirejs-rails-0.9.3/lib/tasks/requirejs-rails_tasks.rake :86:in block (3 levels) in <top (required)>'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in
call' /home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:240:in block in execute'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:in
each' /home/whyves/.rvm /gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:235:inexecute'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:179:in
块 in invoke_with_call_chain' /home/whyves/.rvm/rubies/ruby-2.1.2/lib/ ruby/2.1.0/monitor.rb:211:inmon_synchronize'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in
invoke_with_call_chain' /home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:201:in block in invoke_prerequisites'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:199:in
each' /home/whyves/.rvm/gems/ruby -2.1.2/gems/rake-10.3.2/lib/rake/task.rb:199:invoke_prerequisites'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:178:in
invoke_with_call_chain'/home/whyves/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1 中的块。 0/monitor.rb:211:in mon_synchronize'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:172:in
invoke_with_call_chain '/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/task.rb:165:in invoke_task invoke'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:150:in
'/home /whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in block (2 levels) in top_level'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:106:in
each' /home/whyves/.rvm/gems/ruby-2.1.2 /gems/rake-10.3.2/lib/rake/application.rb:106:in block in top_level'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:115:in
run_with_threads' /home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/应用程序.rb:100:intop_level'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:78:in
阻止运行' /home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:176:in standard_exception_handling'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/rake-10.3.2/lib/rake/application.rb:75:in
run' /home/whyves/RubymineProjects/test2/ bin/rake:8:in <top (required)>'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in
load' /home/whyves/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in block in load'
/home/whyves/.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:232:in
load_dependency' /home/whyves /.rvm/gems/ruby-2.1.2/gems/activesupport-4.1.4/lib/active_support/dependencies.rb:241:in load'
/home/whyves/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in
require' /home/whyves/.rvm/rubies/ruby-2.1.2/lib /ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in require'
-e:1:in
'任务:TOP => assets:precompile => requirejs:precompile:external
进程以退出代码 1 结束
`