重建失败 - 可能与 rolldown 有关?

大家好,我刚刚尝试使用 discourse/base:2.0.20260617-0053 进行重建。但是,我遇到了一些与缺少包相关的错误。

Got some warnings
╭ Warning ─────────────────────────────────────────────────────────────────────╮
│                                                                              │
│   Ignored build scripts: core-js@2.6.12, core-js@3.49.0, lefthook@2.1.9,     │
│   rete@2.0.6.                                                                │
│   Run "pnpm approve-builds" to pick which dependencies should be allowed     │
│   to run scripts.                                                            │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
Done in 10.4s using pnpm v10.28.0
Lockfile is up to date, resolution step is skipped
Already up to date

╭ Warning ─────────────────────────────────────────────────────────────────────╮
│                                                                              │
│   Ignored build scripts: core-js@2.6.12, core-js@3.49.0, lefthook@2.1.9,     │
│   rete@2.0.6.                                                                │
│   Run "pnpm approve-builds" to pick which dependencies should be allowed     │
│   to run scripts.                                                            │
│                                                                              │
╰──────────────────────────────────────────────────────────────────────────────╯
.....
Successfully installed aws-sdk-translate-1.35.0
1 gem installed
rake aborted!
Discourse::Utils::CommandError: pnpm -C=frontend/asset-processor node build.mjs (Discourse::Utils::CommandError)
file:///var/www/discourse/node_modules/.pnpm/rolldown@1.1.2/node_modules/rolldown/dist/shared/error-T-E9reEy.mjs:48
        const wrapper = new Error(summary);
                        ^

Error: Build failed with 9 errors:

[RESOLVE_ERROR] Could not resolve './shims' in transpiler.js
   ╭─[ transpiler.js:1:8 ]
   │
 1 │ import "./shims";
   │        ────┬────
   │            ╰────── Tsconfig not found
───╯

[RESOLVE_ERROR] Could not resolve './postcss' in transpiler.js
   ╭─[ transpiler.js:2:8 ]
   │
 2 │ import "./postcss";
   │        ─────┬─────
   │             ╰─────── Tsconfig not found
───╯

[RESOLVE_ERROR] Could not resolve './asset-processor-rollup' in transpiler.js
   ╭─[ transpiler.js:3:8 ]
   │
 3 │ import "./asset-processor-rollup";
   │        ─────────────┬────────────
   │                     ╰────────────── Tsconfig not found
───╯

[RESOLVE_ERROR] Could not resolve '@babel/standalone' in transpiler.js
   ╭─[ transpiler.js:4:45 ]
   │
 4 │ import { transform as babelTransform } from "@babel/standalone";
   │                                             ─────────┬─────────
   │                                                      ╰─────────── Tsconfig not found
───╯

[RESOLVE_ERROR] Could not resolve 'decorator-transforms' in transpiler.js
   ╭─[ transpiler.js:5:33 ]
   │
 5 │ import DecoratorTransforms from "decorator-transforms";
   │                                 ───────────┬──────────
   │                                            ╰──────────── Tsconfig not found
───╯
/var/www/discourse/lib/discourse.rb:180:in 'Discourse::Utils::CommandRunner#execute_command'
/var/www/discourse/lib/discourse.rb:146:in 'Discourse::Utils::CommandRunner#exec'
/var/www/discourse/lib/discourse.rb:33:in 'Discourse::Utils.execute_command'
/var/www/discourse/lib/asset_processor.rb:58:in 'AssetProcessor.build_asset_processor'
/var/www/discourse/lib/asset_processor.rb:107:in 'block in AssetProcessor.load_or_build_processor_source'
/var/www/discourse/lib/asset_processor.rb:86:in 'block in AssetProcessor.with_file_lock'
/var/www/discourse/lib/asset_processor.rb:84:in 'IO.open'
/var/www/discourse/lib/asset_processor.rb:84:in 'AssetProcessor.with_file_lock'
/var/www/discourse/lib/asset_processor.rb:103:in 'AssetProcessor.load_or_build_processor_source'
/var/www/discourse/lib/tasks/assets.rake:161:in 'block in <main>'
/var/www/discourse/vendor/bundle/ruby/3.4.0/gems/rake-13.4.2/exe/rake:27:in '<top (required)>'
/usr/local/bin/bundle:25:in 'Kernel#load'
/usr/local/bin/bundle:25:in '<main>'
Tasks: TOP => db:migrate => assets:precompile:asset_processor
(See full trace by running task with --trace)
19:signal-handler (1782860705) Received SIGTERM scheduling shutdown...
I, [2026-06-30T23:05:05.686770 #1]  INFO -- : Terminating async processes
I, [2026-06-30T23:05:05.686855 #1]  INFO -- : Sending TERM to exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 19
19:M 30 Jun 2026 23:05:05.697 * User requested shutdown...
19:M 30 Jun 2026 23:05:05.697 * Saving the final RDB snapshot before exiting.
19:M 30 Jun 2026 23:05:05.743 * DB saved on disk
19:M 30 Jun 2026 23:05:05.743 # Redis is now ready to exit, bye bye...


FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'bundle exec rake db:migrate' failed with return #<Process::Status: pid 3131 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.4.0/gems/pups-1.4.0/lib/pups/exec_command.rb:138:in 'Pups::ExecCommand#spawn'
exec failed with the params {"cd" => "$home", "tag" => "migrate", "hook" => "db_migrate", "cmd" => ["su discourse -c 'bundle exec rake db:migrate'"]}
bootstrap failed with exit code 1
** FAILED TO BOOTSTRAP ** please scroll up and look for earlier error messages, there may be more than one.
./discourse-doctor may help diagnose the problem.

我尝试过删除 node_modules 并手动运行 pnpm install,但都没有成功。我也在容器中尝试过 pnpm approve-builds,但它提示没有需要批准的包?

有其他人遇到过这个问题吗?我用这个镜像为另一个论坛成功完成了重建。我尝试使用 ./launcher rebuild app 进行重建。

关于此事是否有任何进展,或者有哪些步骤可以让重建继续进行?谢谢!

您是否安装了任何插件?

不,只有通常的官方说辞

@tanya_byrne,你是否正在标准安装下运行 Discourse 的“最新”版本?

你是否了解这两台机器/论坛之间是否存在任何显著差异?

看起来这个错误可能是由于对核心插件运行 rm -rf 命令导致的。这是一个非常危险的操作——Discourse 的所有测试都是在所有核心插件都存在的情况下进行的。因此,我建议从您的 app.yml 文件中删除该行。

话虽如此,我们可以改进这个 asset-processor 构建过程,使其不会如此严重地崩溃:

大卫,那么,我们如何在不先删除核心插件并替换为分叉版本的情况下,覆盖核心插件中的模板呢?这样做是否安全?原始资源是否会残留?

以前在没有其他选择的情况下,我曾成功采用过这种方法。

覆盖模板并不是一个“受支持”的功能。

当然,你可以自行承担风险进行操作,这“可能”没问题。但我们无法为此提供保证或进行测试。

不过,我很感激你让这里的问题变得不那么严重了!

我只是希望,在可能的情况下,我们能够保持插件完全模块化的状态。

这确实是问题所在。您是否有任何建议来隐藏/移除这些插件?因为我觉得移除我们不使用的插件不应该导致构建失败,毕竟插件应该是模块化的。

“受支持”的方式是通过管理界面禁用插件。

你可以自由地在文件系统中删除它们,这“可能”会起作用(正如你所说,理想情况下插件应该是模块化的)。但这并不是我们目前严格测试的内容,所以我不能对此提供100%的保证。

谢谢 David,感谢你的指导。

我完全赞同你的看法。

我认为,默认情况下应该能够完全从管理界面隐藏插件(而不仅仅是禁用它们),以减少界面杂乱,这很合理。

插件绝对应该是模块化的。

虽然我理解有时会有技术上的考量,但在我看来,这应该是最终目标。

但我们也应该为此捆绑带来的构建速度大幅提升而欢呼 :rocket: