rails 4 - rake command shows deprecation warning everytime I run the rake db:migrate command

◇◆丶佛笑我妖孽 提交于 2020-07-18 03:53:30

问题


[pinterestclone]$ rake db:migrate  

DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.  
Please register a mime type using `register_mime_type` then  
use `register_compressor` or `register_transformer`.  
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors  
 (called from block (2 levels) in <class:Railtie> at  /usr/local/lib/ruby/gems/2.3.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:57)  

DEPRECATION WARNING: Sprockets method `register_engine` is deprecated.
Please register a mime type using `register_mime_type` then
use `register_compressor` or `register_transformer`.
https://github.com/rails/sprockets/blob/master/guides/extending_sprockets.md#supporting-all-versions-of-sprockets-in-processors
 (called from block (2 levels) in <class:Railtie> at /usr/local/lib/ruby/gems/2.3.0/gems/sass-rails-5.0.5/lib/sass/rails/railtie.rb:58)

== 20160721232702 AddUserIdToPins: migrating ==================================  
-- add_column(:pins, :user_id, :integer)  
   -> 0.0010s  
-- add_index(:pins, :user_id)  
   -> 0.0010s  
== 20160721232702 AddUserIdToPins: migrated (0.0022s) =========================

回答1:


This is caused by Sprockets 3.7.0 and should be fixed in sass-rails (which uses Sprockets) shortly. See this for more information.

I guess Sprockets 4 requires you to register a mime type before calling register_engine.

UPDATE: This is now fixed in sass-rails version 5.0.6. Running bundle update should remove the deprecation warnings.




回答2:


To fix this open your project in terminal and write "bundle update sprockets"



来源:https://stackoverflow.com/questions/38515972/rails-4-rake-command-shows-deprecation-warning-everytime-i-run-the-rake-dbmig

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!