【问题标题】:Deploy to heroku generating plugin deprecation warning, but no plugins exist部署到 heroku 生成插件弃用警告,但不存在插件
【发布时间】:2012-04-24 09:01:55
【问题描述】:

我在将 Rail 应用程序部署到 Heroku 时遇到了困难。我真的很感激一个想法清单来解决这个问题,我已经用尽了我的想法正在诉诸于拔掉我的头发!

短篇小说: heroku run rake db:migrate 产生错误:

Running rake db:migrate attached to terminal... up, run.1
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
DEPRECATION WARNING: You have Rails 2.3-style plugins in vendor/plugins! Support for these plugins will be removed in Rails 4.0. Move them out and bundle them in your Gemfile, or fold them in to your app as lib/myplugin/* and config/initializers/myplugin.rb. See the release notes for more on this: http://weblog.rubyonrails.org/2012/01/04/rails-3-2-0-rc2-has-been-released. (called from <top (required)> at /app/Rakefile:7)
rake aborted!
syntax error on line 7, col 11: `'

这看起来应该很容易修复。问题是,我没有任何插件!

长篇大论:我正准备重新部署 Rails 应用程序以进行暂存。这是 Heroku 上的 Rails 3.0 应用程序,我刚刚完成了一次重大升级,包括升级到 Rails 3.2、Ruby 1.9.2、删除插件和重大重写。我现在正在尝试推送到 Heroku 的 cedar 堆栈以进行更多测试。

这几天我一直在努力解决这个问题,并一直认为我正在取得进展,但后来感到失望。最近,我认为我的 git 存储库没有对齐,并且 Heroku 远程包含这些插件的旧提交。我不再认为是这种情况。 (我确实想检查一下,但由于这个错误,我无法进入 Heroku 控制台来验证文件结构)。

确认一下,我的 vendor/plugins 文件夹在我的本地 master 和远程 github repo 上肯定是空的。它在远程 Heroku 分支上应该是空的,因为我已经推送了所有更新(我什至用新的远程名称创建了一个完全空白的应用程序来测试,但得到了同样的错误)。我说 vendor/plugins 是空的,但实际上 vendor/plugins 是不存在的,在我删除其中的插件后已被完全删除。

我确实在早期版本的应用程序中安装了两个插件:HABTM 复选框和 fancybox-rails。这些都已被卸载rails plugin remove &lt;&lt;plugin name&gt;&gt;

我检查了错误/app/rakefile:7 中引用的文件,但看不出这行MyApp::Application.load_tasks 有什么问题。

如果我尝试启动 heroku 控制台,错误会略有不同,并引用 /app/config/environment.rb:5)。我在这里也看不到任何东西MyApp::Application.initialize!

我已经通过所有可能的地方寻找这些插件的任何残余或旧的require 语句,但一无所获。

我真的很感激任何关于我可以在哪里寻找的想法。如果需要,我可以提供更多信息,我只是不确定现阶段有什么用处!

谢谢你帮我留头发!!

编辑

我正在添加错误中提到的 rakefile 的全部内容。我看不出这有什么问题。

# Add your own tasks in files placed in lib/tasks ending in .rake,
# for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.

require File.expand_path('../config/application', __FILE__)
require 'rake'

MyApp::Application.load_tasks

【问题讨论】:

    标签: ruby-on-rails heroku


    【解决方案1】:

    经过大量的拉扯和挫败后,我终于在日志中找到了以下条目

    /usr/local/lib/ruby/1.9.1/syck.rb:135:in `load': syntax error on line 7, col 11: `' (ArgumentError)
    

    syck.rb 解析 yaml 文件,我发现我有一个(小)问题,yaml 文件省略了一些特定于环境的信息。

    有关详细信息,请参阅this SO question

    【讨论】:

      【解决方案2】:

      插件弃用警告来自 Heroku 在构建时注入到您的应用程序中的插件,因此它可以在平台上正常运行。这些可以忽略。

      问题的症结似乎与源/rake 文件中的语法错误有关。这是重要的输出:

      rake aborted!
      syntax error on line 7, col 11: `'
      

      查看错误源自文件的第 7 行(发布堆栈跟踪的其余部分以供我们参考?),您会发现某种需要修复的语法错误。

      如果您想清楚地区分插件加载和应用加载时间,请使用 heroku run bash 加载 shell,然后运行 ​​rake 任务以查看其输出隔离:

      $ heroku run bash
      > bundle exec rake db:migrate
      

      希望对您有所帮助。

      【讨论】:

      • 嗨@ryan,感谢这些建议。 rake 文件似乎没有任何问题,我已经用完整的文件内容更新了我的问题,也许我忽略了一些东西?我还从 heroku bash 运行了迁移,并在此处发布了完整的跟踪 git://gist.github.com/2480912.git。我非常感谢您提出的任何建议。
      • 嗨,瑞安,我还在为此烦恼!有什么想法浮现在脑海中吗?我完全被难住了!尤其是应用在本地部署良好。
      【解决方案3】:

      我在某处读到 heroku 使用插件来自动化一些任务......所以这不是你的错

      如果您想消除弃用警告,请使用这个小 sn-p:

      # Load the rails application
      require File.expand_path('../application', __FILE__)
      
      # Initialize the rails application
      ActiveSupport::Deprecation.silence do
        Selfcare::Application.initialize!
      end
      

      【讨论】:

      • 嗨,水手,谢谢。我也看过这个信息。但我担心我的 db:migration rake 被 Heroku 使用的插件中止。我假设 Heroku 的插件会生成弃用警告,但 rake 会继续进行。这让我相信其他事情正在发生。我将尝试消除警告并查看它是否允许我迁移数据库。谢谢
      • 嗨,水手,不幸的是,消除弃用错误没有效果。当我对此进行更多检查时,我认为这不是插件造成的。该错误引发了 rakefile,但我看不到任何问题,并且该应用程序在 localhost 上部署良好。有任何想法吗?我在 git://gist.github.com/2480912.git 上放了一个完整的堆栈跟踪
      猜你喜欢
      • 2012-02-23
      • 2011-10-03
      • 2012-10-30
      • 2015-10-20
      • 2023-03-25
      • 2014-01-23
      • 2018-12-18
      • 2020-11-02
      • 2018-10-16
      相关资源
      最近更新 更多