# テーマコンポーネントのアップデートは常に古いバージョンをインストールします（rakeまたは手動経由）

**URL:** https://meta.discourse.org/t/theme-component-update-always-installs-old-version-via-rake-or-manually-solved/388241
**Category:** Support
**Created:** [2025 年 11 月 12 日午前 11:57 UTC](https://meta.discourse.org/t/theme-component-update-always-installs-old-version-via-rake-or-manually-solved/388241 "2025-11-12T11:57:22Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![toad](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@toad](https://meta.discourse.org/u/toad)
#### Post date: [2025 年 11 月 12 日午前 11:57 UTC](https://meta.discourse.org/t/theme-component-update-always-installs-old-version-via-rake-or-manually-solved/388241/1 "2025-11-12T11:57:22Z")

</div>

これと非常に似た問題が再発しているようです：

- [Theme component upgrade via rake not working](https://meta.discourse.org/t/theme-component-upgrade-via-rake-not-working/152322?tl=en)

Discourse 3.5.2 で、特定のコンポーネント（ソースから）をインストールしようとすると、常に古いバージョンがインストールされてしまいます。エクスポートして確認すると、古い JavaScript が含まれていることがわかります。また、ブラウザの開発者ツールでファイルを検索すると、常に古いバージョンのファイルが表示されます。`about.json` で名前を変更してビルドしても、古い名前が表示されます。

これは、コンポーネントページから GitHub で手動でインストールする場合でも、`app.yml` からインストールする場合でも同様です。

[Install a Theme programatically](https://meta.discourse.org/t/install-a-theme-programatically/191843) に従って、私の `app.yml` の末尾は以下の通りです：

```plaintext
## ビルド後に実行するカスタムコマンド
run:
  - exec: echo "Beginning of custom commands"
  ## 最初の登録用の 'From' メールアドレスを設定したい場合は、コメントを解除して変更してください：
  ## 最初のサインアップメールを受信したら、再度コメントアウトしてください。一度だけ実行すれば十分です。
  #- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"

  - file:
      path: /tmp/mythemes.yml
      contents: |
        discourse-new-topic-button:
          url: https://github.com/toad/discourse-new-topic-button-theme-component.git
          add_to_all_themes: true
  
  # 古いリポジトリ - 何らかの奇妙なキャッシュのため、コミットごとに新しいリポジトリを作成する必要があるようです？

  #url: https://github.com/toad/discourse-new-topic-button.git
  #url: https://github.com/toad/discourse-new-topic-button-theme-component.git
  #url: https://github.com/toad/discourse-new-topic-button-mod.git

  - exec:
      cd: $home
      cmd: su discourse -c 'bundle exec rake themes:install < /tmp/mythemes.yml'

  - exec: echo "End of custom commands"

```

出力結果は以下の通りです：

```plaintext
I, [2025-11-12T01:43:24.323446 #1] INFO -- : > echo "Beginning of custom commands"
I, [2025-11-12T01:43:24.325106 #1] INFO -- : Beginning of custom commands

I, [2025-11-12T01:43:24.327203 #1] INFO -- : File > /tmp/mythemes.yml chmod: chown: 
I, [2025-11-12T01:43:24.327361 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'bundle exec rake themes:install < /tmp/mythemes.yml'
I, [2025-11-12T01:43:32.778093 #1] INFO -- : discourse-new-topic-button: installed from https://github.com/toad/discourse-new-topic-button.git

Results:
 Installed: 1
 Updated: 0
 Errors: 0
 Skipped: 0

I, [2025-11-12T01:43:32.778262 #1] INFO -- : > echo "End of custom commands"
I, [2025-11-12T01:43:32.779694 #1] INFO -- : End of custom commands

```

ビルド前にコンポーネントを削除しない場合、「Installed」ではなく「Updated」と表示されますが、どちらの場合でも最終的に古いバージョンのコンポーネントが残ってしまいます。

ページを離れて Shift+Reload などをしても何の変化もありません。別のリポジトリに移動しても変化はありません（2つのリポジトリは同じです）。

コンテナ内で直接 rake を使ってビルドすることも試しました。

この問題をデバッグする方法はありますか？ビルドログを見ることができれば便利ですが、`rake --verbose` では追加情報は得られません。

私のセットアップは少し特殊です（本番環境では rootless Docker を使用していますが、これはステージングサーバーです）。

助けてください！

どうやら、常にコミット `990dec4f3e8411215122c74b2684782244eeffa2` より前の何かをビルドしているようです。このコミットでは「New Topic Button」が Glimmer サポートに移行しており、3.6 では必須になります。そのため、3.6 にアップグレードすると壊れてしまいます。私は「New Topic Button」コンポーネントのフォークを修正しようとしていますが、上流バージョンでも壊れるようです。

もう一度、この問題をデバッグするにはどうすればよいでしょうか？😐

---

<div class="post-metadata">

### Author: ![Moin](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moin/32/554653_2.png) [@Moin](https://meta.discourse.org/u/Moin)
#### Post date: [2025 年 11 月 12 日午後 12:30 UTC](https://meta.discourse.org/t/theme-component-update-always-installs-old-version-via-rake-or-manually-solved/388241/2 "2025-11-12T12:30:20Z")

</div>

互換性ファイルは、3.6より前のDiscourseインストール用に特定のバージョンをインストールします。

> <https://github.com/toad/discourse-new-topic-button-theme-component/blob/main/.discourse-compatibility>

> [@Pinning plugin and theme versions for older Discourse installs (.discourse-compatibility)](https://meta.discourse.org/t/pinning-plugin-and-theme-versions-for-older-discourse-installs-discourse-compatibility/272665):
>
> open_book Background Sometimes themes/plugins need to make changes which are only compatible with the latest version of Discourse. In that situation, older versions of Discourse can be instructed to use an older ‘pinned’ version of the plugin. This is achieved using a .discourse-compatibility file in the root of a theme/plugin repository. It’s a YAML file where keys specify the Discourse core version, and the values represent the associated version of your theme/plugin. Discourse core versio…

---

<div class="post-metadata">

### Author: ![toad](https://avatars.discourse-cdn.com/v4/letter/t/8c91f0/32.png) [@toad](https://meta.discourse.org/u/toad)
#### Post date: [2025 年 11 月 12 日午後 12:33 UTC](https://meta.discourse.org/t/theme-component-update-always-installs-old-version-via-rake-or-manually-solved/388241/3 "2025-11-12T12:33:49Z")

</div>

Oops! ありがとうございます。😀

面白いですね。Glimmerの機能は3.5と互換性があるはずなので、上流への移植がまだ未成熟なのかもしれません。試してみることにしますし、3.6のものも見てみようと思います。ありがとうございます。

更新：誤報でした。3.6に特有の変更が追加されたものの、3.5版でウィジェットの削除に関する警告が修正されました。これで満足です。

PS: ボタンの移動（私の変更）により、上流のバグ（カテゴリが自動検出されない）が修正されました。詳細は以下をご覧ください：

- [New Topic Button: Category is not auto-detected](https://meta.discourse.org/t/new-topic-button-category-is-not-auto-detected/388254)

---

<div class="post-metadata">

### Author: ![system](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/system/32/443519_2.png) [@system](https://meta.discourse.org/u/system)
#### Post date: [2025 年 12 月 12 日午後 12:34 UTC](https://meta.discourse.org/t/theme-component-update-always-installs-old-version-via-rake-or-manually-solved/388241/4 "2025-12-12T12:34:16Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
