【问题标题】:What happened to mimemagic?mimemagic怎么了?
【发布时间】:2021-06-21 09:48:17
【问题描述】:

mimemagic 发生了什么? @rails 活动记录取决于 @大本营 marcel 依赖于 mimemagic 0.3.2。现在 mimemagic 0.3.2 已经被淘汰了,接下来的路是什么?

【问题讨论】:

    标签: ruby-on-rails


    【解决方案1】:

    你可以拿回宝石。构建的 gem 二进制文件可能已被删除,但每个版本的提交 ref 仍然存在。您可以像这样使用 github commit ref 引用 gem:

    # 0.3.2
    gem 'mimemagic', github: 'mimemagicrb/mimemagic', ref: '3543363026121ee28d98dfce4cb6366980c055ee'
    

    对于其他提交参考,你可以看到这个链接:

    https://github.com/mimemagicrb/mimemagic/commits/0.3?after=22c06826417ed67c02b94ebc9998c24da5a03c56+69&branch=0.3
    
    

    【讨论】:

      【解决方案2】:

      注意:升级到 Mimemagic 0.3.8 仍处于 GPL-2.0 许可下,这可能并非在所有情况下都可取。

      我今天遇到了这个问题,这就是我最终解决问题的方法
      (我使用的是 MBP Catalina 10.15.7)

      第 1 步:通过运行将 Gemfile.lock 更新为 mimemagic 0.3.8

        $ brew install shared-mime-info
        $ bundle update mimemagic
      

      (确保您要部署的系统安装了正确的库)。

      ✅ 感谢 this comment 解决了 Mimemagic 问题

      第 2 步:升级纱线包
      当我这样做时,它更新了自制软件中的所有内容,所以当我重新启动服务器时,我收到了

        Your Yarn packages are out of date!
        Please run `yarn install` to update.
      

      但是,运行 $yarn install 给了我错误:

        dyld: Library not loaded: /usr/local/opt/icu4c/lib/libicui18n.67.dylib
        Referenced from: /usr/local/bin/node
      

        yarn check v1.22.10
        warning Integrity check: System parameters don't match
        error Integrity check failed
        error Found 1 errors.
      

      最终通过运行修复了纱线问题

         $ yarn --update-checksums
      

      ? 纱线问题已解决(感谢blog post

      第 3 步最后,brew 还将我的 Postgresql 从 12 更新到 13.2,所以我收到了

        PG::ConnectionBad - could not connect to server: No such file or directory
        Is the server running locally and accepting connections on Unix domain socket "/tmp/.s.PGSQL.5432"?
      

      没有要删除的 PID,停止和重新启动,卸载和重新加载,启动 ctl 不起作用...终于,这工作了 通过运行检查 postgres.log

        $ tail -n 10 /usr/local/var/log/postgres.log 
      

      最后一行显示:

       FATAL:  database files are incompatible with server
       DETAIL:  The data directory was initialized by PostgreSQL version 12, which is not compatible with this version 13.2.
      

      ?? 固定为:

        $ brew postgresql-upgrade-database
      

      最后,感谢this post,修复了 postgres db 升级

      【讨论】:

        【解决方案3】:

        由于 gem 本身违反 GPL 许可要求,gem 作者已下架所有版本。目前有人正在开发解决方案来制作与 MIT 兼容的解决方案或解决依赖关系。

        讨论:https://github.com/rails/rails/issues/41750

        【讨论】:

          【解决方案4】:

          Rails 团队发布了一个补丁更新,删除了 mimemagic 依赖项。 Marcel 库现在使用 Apache Tika,在许可和兼容的 Apache License 2.0 下发布

          阅读更多:https://weblog.rubyonrails.org/2021/3/26/marcel-upgrade-releases/

          【讨论】:

            【解决方案5】:

            解决方法的硬编码 gem 参考 here

            【讨论】:

              【解决方案6】:

              请安装 shared-mime-info 并在您的环境中添加 FREEDESKTOP_MIME_TYPES_PATH。 如果你使用windows或linux,请从https://gitlab.freedesktop.org/xdg/shared-mime-info/uploads/0440063a2e6823a4b1a6fb2f2af8350f/shared-mime-info-2.0.tar.xz下载并解压

              【讨论】:

              • 这应该是公认的答案! :) 完美运行!
              【解决方案7】:

              通过将mimemagic 版本更新为0.3.6 我的Gemfile.lock 来解决此问题

              【讨论】:

              • 请注意,这对大多数人来说并不是一个好的解决方案。该版本的反向移植是在 GPL 下获得许可的,这意味着您的任何代码也必须是 GPL。 GPL 要求其衍生的所有源代码都是开源的,这不适用于绝大多数 Rails 项目,可能包括您自己的项目。
              • 如果您不分发源代码也可以,例如SaaS 产品源代码不是分发的,而是通过网络访问的。 resources.whitesourcesoftware.com/blog-whitesource/…
              猜你喜欢
              • 1970-01-01
              • 1970-01-01
              • 2020-07-01
              • 2015-06-29
              • 2012-09-05
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              • 1970-01-01
              相关资源
              最近更新 更多