你好。我在升级 Discourse 时遇到了这个错误。你们知道如何解决吗?
这是我的 Discourse 版本
<meta name="generator" content="Discourse 3.4.0.beta2-dev - https://github.com/discourse/discourse version 41c3c5745e0611828cb6ed84e5e625faf12df13a">
操作系统信息
NAME="Ubuntu"
VERSION="20.04.6 LTS (Focal Fossa)"
ID=ubuntu
ID_LIKE=debian
PRETTY_NAME="Ubuntu 20.04.6 LTS"
VERSION_ID="20.04"
HOME_URL="https://www.ubuntu.com/"
SUPPORT_URL="https://help.ubuntu.com/"
BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/"
PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy"
VERSION_CODENAME=focal
UBUNTU_CODENAME=focal
Docker 版本
Docker version 26.1.0, build 9714adc
/var/discourse/containers/app.yml
## 这是独立运行的 Discourse Docker 容器模板(all-in-one)
##
## 修改此文件后,你必须重新构建
## /var/discourse/launcher rebuild app
##
## 编辑时请 *非常* 小心!
## YAML 文件对空白或缩进的错误极其敏感!
## 必要时请访问 http://www.yamllint.com/ 验证此文件
templates:
- "templates/postgres.template.yml"
- "templates/redis.template.yml"
- "templates/web.template.yml"
- "templates/web.ratelimited.template.yml"
## 如果你想添加 Lets Encrypt (https),请取消注释这两行
- "templates/web.ssl.template.yml"
- "templates/web.letsencrypt.ssl.template.yml"
## 此容器应暴露哪些 TCP/IP 端口?
## 如果你想让 Discourse 与 Apache 或 nginx 等其他 Web 服务器共享端口,
## 请参阅 https://meta.discourse.org/t/17247 了解详情
expose:
- "80:80" # http
- "443:443" # https
params:
db_default_text_search_config: "pg_catalog.english"
## 将 db_shared_buffers 设置为总内存的最大 25%。
## 将根据检测到的 RAM 由 bootstrap 自动设置,或者你可以覆盖它
db_shared_buffers: "256MB"
## 可以提高排序性能,但会增加每个连接的内存使用量
#db_work_mem: "40MB"
## 此容器应使用哪个 Git 修订版?(默认:tests-passed)
#version: tests-passed
env:
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LANGUAGE: en_US.UTF-8
EMBER_CLI_PROD_ASSETS: 1
# DISCOURSE_DEFAULT_LOCALE: en
## 支持的并发 Web 请求数量?取决于内存和 CPU 核心数。
## 将根据检测到的 CPU 由 bootstrap 自动设置,或者你可以覆盖它
UNICORN_WORKERS: 4
## TODO: 此 Discourse 实例将响应的域名
## 必需。Discourse 无法仅使用裸 IP 地址运行。
DISCOURSE_HOSTNAME: discourse.abcdef.com
## 如果你想让容器以与上面指定的相同的主机名(-h 选项)启动,请取消注释
## (默认 "$hostname-$config")
#DOCKER_USE_HOSTNAME: true
## TODO: 初始注册时将设为管理员和开发人员的逗号分隔邮箱列表
## 示例 'user1@example.com,user2@example.com'
DISCOURSE_DEVELOPER_EMAILS: 'email@abcdef.com'
## TODO: 用于验证新账户和发送通知的 SMTP 邮件服务器
# SMTP 地址、用户名和密码是必需的
# 警告:SMTP 密码中的字符 '#' 可能会导致问题!
DISCOURSE_SMTP_ADDRESS: smtp.mailgun.org
DISCOURSE_SMTP_PORT: 587
DISCOURSE_SMTP_USER_NAME: yummy@abcdef.com
DISCOURSE_SMTP_PASSWORD: "aaaaaaaaaaaaaaaaaaaaaaaa-bbbbbbbb-ccccccccccc"
#DISCOURSE_SMTP_ENABLE_START_TLS: true # (可选,默认为 true)
DISCOURSE_SMTP_DOMAIN: abcdef.com
DISCOURSE_NOTIFICATION_EMAIL: yummy@abcdef.com
## 如果你添加了 Lets Encrypt 模板,请取消注释以下行以获取免费 SSL 证书
LETSENCRYPT_ACCOUNT_EMAIL: yummy@abcdef.com
## 此 Discourse 实例的 http 或 https CDN 地址(配置为拉取)
## 请参阅 https://meta.discourse.org/t/14857 了解详情
#DISCOURSE_CDN_URL: https://discourse-cdn.example.com
## MaxMind 地理位置 IP 地址查询的许可证密钥
## 请参阅 https://meta.discourse.org/t/-/137387/23 了解详情
#DISCOURSE_MAXMIND_LICENSE_KEY: 1234567890123456
## Docker 容器是无状态的;所有数据都存储在 /shared 中
volumes:
- volume:
host: /var/discourse/shared/standalone
guest: /shared
- volume:
host: /var/discourse/shared/standalone/log/var-log
guest: /var/log
## 插件放在这里
## 请参阅 https://meta.discourse.org/t/19157 了解详情
hooks:
after_code:
- exec:
cd: $home/plugins
cmd:
- git clone https://github.com/discourse/docker_manager.git
- git clone https://github.com/discourse/discourse-math.git
- git clone https://github.com/discourse/discourse-chat-integration.git
- git clone https://github.com/discourse/discourse-cakeday.git
- git clone https://github.com/discourse/discourse-akismet.git
- git clone https://github.com/discourse/discourse-github.git
- git clone https://github.com/discourse/discourse-solved.git
- git clone https://github.com/discourse/discourse-translator.git
- git clone https://github.com/discourse/discourse-code-review.git
- git clone https://github.com/discourse/discourse-voting.git
- git clone https://github.com/discourse/discourse-data-explorer.git
- git clone https://github.com/discourse/discourse-reactions.git
- git clone https://github.com/discourse/discourse-automation.git
- git clone https://github.com/discourse/discourse-tooltips.git
- git clone https://github.com/discourse/discourse-assign.git
- git clone https://github.com/discourse/discourse-encrypt.git
- git clone https://github.com/discourse/discourse-rss-polling.git
- git clone https://github.com/discourse/discourse-user-card-badges.git
- git clone https://github.com/discourse/discourse-teambuild.git
- git clone https://github.com/discourse/discourse-prometheus.git
- git clone https://github.com/discourse/discourse-calendar.git
- git clone https://github.com/discourse/discourse-docs.git
- git clone https://github.com/discourse/discourse-gamification.git
- git clone https://github.com/discourse/discourse-bbcode-color.git
- git clone https://github.com/discourse/discourse-follow.git
- git clone https://github.com/discourse/discourse-templates.git
- git clone https://github.com/discourse/discourse-shared-edits.git
- git clone https://github.com/discourse/discourse-category-experts.git
- git clone https://github.com/discourse/discourse-graphviz.git
- git clone https://github.com/discourse/discourse-post-voting.git
- git clone https://github.com/discourse/discourse-saved-searches.git
- git clone https://github.com/discourse/discourse-staff-alias.git
- git clone https://github.com/discourse/discourse-policy.git
- git clone https://github.com/discourse/discourse-whos-online.git
- git clone https://github.com/discourse/discourse-bcc.git
- git clone https://github.com/discourse/discourse-ai.git
- git clone https://github.com/discourse/discourse-algolia.git
## 构建后运行的任何自定义命令
run:
- exec: echo "开始自定义命令"
## 如果你想设置首次注册的'发件人'邮箱地址,请取消注释并修改:
## 收到首次注册邮件后,请重新注释该行。它只需运行一次。
#- exec: rails r "SiteSetting.notification_email='info@unconfigured.discourse.org'"
- exec: echo "结束自定义命令"
这是我用来升级 Discourse 的命令。
cd /var/discourse
./launcher rebuild app
错误信息
I, [2025-04-10T15:51:32.679706 #1] INFO -- : > cd /var/www/discourse && gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
I, [2025-04-10T15:51:33.940918 #1] INFO -- : 成功安装 bundler-2.6.4
已安装 1 个 gem
I, [2025-04-10T15:51:33.941573 #1] INFO -- : > cd /var/www/discourse && find /var/www/discourse ! -user discourse -exec chown discourse {} \+
I, [2025-04-10T15:51:39.190810 #1] INFO -- :
I, [2025-04-10T15:51:39.191737 #1] INFO -- : > cd /var/www/discourse && if [ -f yarn.lock ]; then
if [ -d node_modules/.pnpm ]; then
echo "此版本的 Discourse 使用 yarn,但已存在 pnpm node_modules。正在清理..."
find ./node_modules ./app/assets/javascripts/*/node_modules -mindepth 1 -maxdepth 1 -exec rm -rf {} +
fi
su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
else
su discourse -c 'CI=1 pnpm install --frozen-lockfile'
fi
I, [2025-04-10T15:51:44.558550 #1] INFO -- : 检测到 yarn 管理的 node_modules。正在执行一次性清理...
清理完成
ERR_PNPM_UNSUPPORTED_ENGINE 不支持的环境(pnpm 和/或 Node.js 版本不正确)
你的 Node 版本与 "/var/www/discourse" 不兼容。
预期版本:>= 20
当前版本:v18.20.4
出现此问题的原因是该包的清单中指定了 engines.node 字段。
要解决此问题,请安装所需的 Node 版本。
I, [2025-04-10T15:51:44.559546 #1] INFO -- : 终止异步进程
I, [2025-04-10T15:51:44.559682 #1] INFO -- : 向 HOME=/var/lib/postgresql USER=postgres exec chpst -u postgres:postgres:ssl-cert -U postgres:postgres:ssl-cert /usr/lib/postgresql/13/bin/postmaster -D /etc/postgresql/13/main pid: 36 发送 INT
I, [2025-04-10T15:51:44.559994 #1] INFO -- : 向 exec chpst -u redis -U redis /usr/bin/redis-server /etc/redis/redis.conf pid: 104 发送 TERM
104:signal-handler (1744300304) 收到 SIGTERM,计划关闭...
2025-04-10 15:51:44.560 UTC [36] LOG: 收到快速关闭请求
2025-04-10 15:51:44.581 UTC [36] LOG: 中止任何活跃事务
104:M 10 Apr 2025 15:51:44.585 # 用户请求关闭...
104:M 10 Apr 2025 15:51:44.586 * 在退出前保存最终 RDB 快照。
2025-04-10 15:51:44.591 UTC [36] LOG: 后台工作进程 "logical replication launcher" (PID 51) 以退出代码 1 退出
2025-04-10 15:51:44.598 UTC [46] LOG: 正在关闭
2025-04-10 15:51:44.634 UTC [36] LOG: 数据库系统已关闭
104:M 10 Apr 2025 15:51:44.947 * 数据库已保存到磁盘
104:M 10 Apr 2025 15:51:44.948 # Redis 现在准备退出,再见...
失败
--------------------
Pups::ExecError: cd /var/www/discourse && if [ -f yarn.lock ]; then
if [ -d node_modules/.pnpm ]; then
echo "此版本的 Discourse 使用 yarn,但已存在 pnpm node_modules。正在清理..."
find ./node_modules ./app/assets/javascripts/*/node_modules -mindepth 1 -maxdepth 1 -exec rm -rf {} +
fi
su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
else
su discourse -c 'CI=1 pnpm install --frozen-lockfile'
fi 执行失败,返回 #<Process::Status: pid 649 exit 1>
失败位置:/usr/local/lib/ruby/gems/3.3.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
执行失败,参数为 {"cd"=>"$home", "hook"=>"yarn", "cmd"=>["if [ -f yarn.lock ]; then\n if [ -d node_modules/.pnpm ]; then\n echo \"此版本的 Discourse 使用 yarn,但已存在 pnpm node_modules。正在清理...\"\n find ./node_modules ./app/assets/javascripts/*/node_modules -mindepth 1 -maxdepth 1 -exec rm -rf {} +\n fi\n su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'\nelse\n su discourse -c 'CI=1 pnpm install --frozen-lockfile'\nfi"]}
bootstrap 以退出代码 1 失败
** bootstrap 失败 ** 请向上滚动并查找更早的错误消息,可能不止一条。
./discourse-doctor 可能有助于诊断问题。
e6f9cd9a001c3b9e1208284621b73506ba021b2350e0c9cca235941538863fd9
当前 discourse-image 中的 node 版本
