不知道如何构建任务“捆绑”-Ruby on Rails

时间:2019-08-06 12:02:47

标签: ruby-on-rails ruby

我正在尝试预编译我的资产:

rake assets:precompile RAILS_ENV=production bundle exec rake assets:precompile

,并出现以下错误:

  

不知道如何构建任务“捆绑包”(请参阅​​带有“ rake --tasks”的可用任务列表)

--trace之后:

** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Invoke yarn:install (first_time)
** Execute yarn:install
yarn install v1.17.3
[1/4] ?  Resolving packages...
success Already up-to-date.
✨  Done in 0.04s.
** Execute assets:precompile
rake aborted!
Don't know how to build task 'bundle' (See the list of available tasks with `rake --tasks`)
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/task_manager.rb:59:in `[]'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:159:in `invoke_task'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block (2 levels) in top_level'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `each'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:116:in `block in top_level'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:125:in `run_with_threads'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:110:in `top_level'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:83:in `block in run'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:186:in `standard_exception_handling'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/lib/rake/application.rb:80:in `run'
/Users/anton/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rake-12.3.3/exe/rake:27:in `<top (required)>'
/Users/anton/.rbenv/versions/2.6.3/bin/rake:22:in `load'
/Users/anton/.rbenv/versions/2.6.3/bin/rake:22:in `<main>'

如何解决此问题?我尝试更新我的gem,重新安装了所有内容,添加了gem 'rake',但仍然遇到相同的错误。非常感谢您的帮助。

Rails版本:~> 5.1.6

1 个答案:

答案 0 :(得分:2)

您似乎混淆了命令,以便尝试将两个命令作为一个来调用。

它似乎出现了,您实际上只是在试图称呼它:

RAILS_ENV=production bundle exec rake assets:precompile

使用您最初使用的命令,您尝试调用名为assets:precompilebundleexecrake的rake任务,然后再次调用assets:precompile 。由于您没有名为bundle的瑞克任务,因此出现了引用的错误。