Intento precompilar activos en mi máquina local. Sigo recibiendo el siguiente error. ¿Cómo puedo arreglar esto?

-ruby 2.3.1p112 (2016-04-26 revisión 54768) [x86_64-darwin16] - Rails 5.0.0.1

rake assets:precompile production --trace
** Invoke assets:precompile (first_time)
** Invoke assets:environment (first_time)
** Execute assets:environment
** Invoke environment (first_time)
** Execute environment
** Execute assets:precompile
rake aborted!
Don't know how to build task 'production' (see --tasks)
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/task_manager.rb:71:in `[]'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:151:in `invoke_task'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `block (2 levels) in top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `each'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:108:in `block in top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:117:in `run_with_threads'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:102:in `top_level'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:80:in `block in run'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:178:in `standard_exception_handling'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/lib/rake/application.rb:77:in `run'
/usr/local/rvm/gems/ruby-2.3.1/gems/rake-11.3.0/exe/rake:27:in `<top (required)>'
/usr/local/rvm/gems/ruby-2.3.1/bin/rake:23:in `load'
/usr/local/rvm/gems/ruby-2.3.1/bin/rake:23:in `<main>'
0
DaveG 2 dic. 2016 a las 18:04
¿Está intentando precompilar los activos en el entorno production?, pruebe esto RAILS_ENV=production rake assets:precompile --trace si no, solo rake assets:precompile --trace funcionará.
 – 
fanta
2 dic. 2016 a las 18:06

1 respuesta

La mejor respuesta

Pase RAILS_ENV con el comando

RAILS_ENV=production bundle exec rake assets:precompile

De esta manera, los rieles precompilarán los activos utilizando la configuración del entorno de producción.

1
Deepak Mahakale 2 dic. 2016 a las 18:06