# 引擎 "yarn" 与此模块不兼容。期望版本 "please-use-pnpm"。但获取到的是 "1.22.19"

**URL:** https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557
**Category:** Support
**Created:** [2025年二月5日 01:17 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557 "2025-02-05T01:17:40Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![CRCinAU](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crcinau/32/249856_2.png) [@CRCinAU](https://meta.discourse.org/u/CRCinAU)
#### Post date: [2025年二月5日 01:17 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557/1 "2025-02-05T01:17:40Z")

</div>

收到可用更新的通知后，我像往常一样进入了 Web 界面并点击了更新按钮。

按照 Discourse 的经典风格，安装现在已自行销毁，我似乎无法重新构建图像来运行。

我正在通过 Docker 运行独立的数据和 Web 图像。

我通常用于修复此问题的手动重建脚本是：

```plaintext
./launcher bootstrap discourse-web && ./launcher destroy discourse-web && ./launcher start discourse-web

```

运行此命令时，它会因以下错误而崩溃：

```plaintext
I, [2025-02-05T01:12:54.160568 #1] INFO -- : > cd /var/www/discourse && gem install bundler --conservative -v $(awk '/BUNDLED WITH/ { getline; gsub(/ /,""); print $0 }' Gemfile.lock)
I, [2025-02-05T01:12:55.503875 #1] INFO -- : Successfully installed bundler-2.5.18
1 gem installed

I, [2025-02-05T01:12:55.503987 #1] INFO -- : > cd /var/www/discourse && find /var/www/discourse ! -user discourse -exec chown discourse {} +
I, [2025-02-05T01:12:56.681293 #1] INFO -- : 

I, [2025-02-05T01:12:56.681583 #1] INFO -- : > cd /var/www/discourse && if ["beta" != "tests-passed"]; then
  rm -rf app/assets/javascripts/node_modules
fi
I, [2025-02-05T01:12:56.685171 #1] INFO -- : 

I, [2025-02-05T01:12:56.685238 #1] INFO -- : > cd /var/www/discourse && su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'
error discourse@: The engine "yarn" is incompatible with this module. Expected version "please-use-pnpm". Got "1.22.19"
warning discourse@: The engine "pnpm" appears to be invalid.
error Found incompatible module.
I, [2025-02-05T01:12:57.086009 #1] INFO -- : yarn install v1.22.19
info No lockfile found.
[1/5] Validating package.json...
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

FAILED
--------------------
Pups::ExecError: cd /var/www/discourse && su discourse -c 'yarn install --frozen-lockfile && yarn cache clean' failed with return #<Process::Status: pid 202 exit 1>
Location of failure: /usr/local/lib/ruby/gems/3.2.0/gems/pups-1.2.1/lib/pups/exec_command.rb:132:in `spawn'
exec failed with the params {"cd"=>"$home", "hook"=>"yarn", "cmd"=>["if [\"$version\" != \"tests-passed\"]; then\n rm -rf app/assets/javascripts/node_modules\nfi", "su discourse -c 'yarn install --frozen-lockfile && yarn cache clean'"]}
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.
d480e23784a1dd765d52d483ee94174d7d5cfad5ba8ccec61e76a48ac8ddf32a

```

我似乎找不到任何匹配此错误的项，并且任何类型的重置/拉取 discourse-base 映像似乎都没有区别——所有这些都在这里失败了。

有没有办法让事情恢复正常运行？

---

<div class="post-metadata">

### Author: ![CRCinAU](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crcinau/32/249856_2.png) [@CRCinAU](https://meta.discourse.org/u/CRCinAU)
#### Post date: [2025年二月5日 01:44 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557/2 "2025-02-05T01:44:21Z")

</div>

记录在案，`discourse/base:2.0.20250129-0720` 中的更新似乎已修复此问题。

---

<div class="post-metadata">

### Author: ![Abinav\_22](https://avatars.discourse-cdn.com/v4/letter/a/ed8c4c/32.png) [@Abinav\_22](https://meta.discourse.org/u/Abinav_22)
#### Post date: [2025年二月7日 11:14 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557/3 "2025-02-07T11:14:44Z")

</div>

嘿 @CRCinAU，我是 discourse 的新手。你能告诉我更多关于我们需要在哪里更新更改的信息吗？

谢谢。

---

<div class="post-metadata">

### Author: ![david](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/david/32/157490_2.png) [@david](https://meta.discourse.org/u/david)
#### Post date: [2025年二月7日 12:42 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557/4 "2025-02-07T12:42:17Z")

</div>

[quote=“CRCinAU, post:1, topic:350557”]  
我手动重建脚本通常可以修复此问题：

```plaintext
./launcher bootstrap discourse-web && ./launcher destroy discourse-web && ./launcher start discourse-web

```

[/quote]您应该确保您也在 `/var/discourse` 中拉取 `discourse_docker` 的最新副本。标准安装中使用的 `./launcher rebuild` 命令会自动处理该问题。但如果您使用的是自定义脚本，则需要自己处理。

[quote=“Zecos22, post:3, topic:350557, username:Abinav\_22”]  
您能提供更多关于在哪里更新更改的信息吗？  
[/quote]您是否看到相同的错误？如果是，请告知我们您正在遵循的步骤以及您看到的错误。

---

<div class="post-metadata">

### Author: ![CRCinAU](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/crcinau/32/249856_2.png) [@CRCinAU](https://meta.discourse.org/u/CRCinAU)
#### Post date: [2025年二月7日 12:58 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557/5 "2025-02-07T12:58:38Z")

</div>

是的，我必须在 `/var/discourse/` 中执行 `git pull`。  
对我来说，重新构建似乎没有执行 git pull，因此它仍然在使用旧的构建器等。

---

<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年三月9日 12:59 UTC](https://meta.discourse.org/t/the-engine-yarn-is-incompatible-with-this-module-expected-version-please-use-pnpm-got-1-22-19/350557/6 "2025-03-09T12:59:33Z")

</div>

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