pfaffman
(Jay Pfaffman)
2025 年6 月 1 日 16:08
1
我从最新的 discourse-theme-skeleton/package.json at main · discourse/discourse-theme-skeleton · GitHub 复制了 [package.json](https://github.com/discourse/discourse-theme-skeleton/blob/main/package.json)
它并不大:
{
private: true,
devDependencies: {
@discourse/lint-configs: "2.21.0",
ember-template-lint: "7.7.0",
eslint: "9.27.0",
prettier: "3.5.3",
stylelint: "16.19.1"
},
engines: {
node: ">= 22",
npm: "please-use-pnpm",
yarn: "please-use-pnpm",
pnpm: "9.x"
},
packageManager: "pnpm@9.15.5"
}
在我尝试本地运行 Right Stuff 时,Linting 可以正常工作,但在 GitHub 上,我遇到了这个错误:
Run yarn install --frozen-lockfile
error This project's package.json defines "packageManager": "yarn@pnpm@9.15.5". However the current global version of Yarn is 1.22.22.
Presence of the "packageManager" field indicates that the project is meant to be used with Corepack, a tool included by default with all official Node.js distributions starting from 16.9 and 14.19.
Corepack must currently be enabled by running corepack enable in your terminal. For more information, check out https://yarnpkg.com/corepack.
而且这发生在“安装 JS 依赖项”步骤中,所以这似乎不可能是我的问题?
这是我的代码:GitHub - pfaffman/discourse-custom-homepage-for-groups: Discourse theme component to change home page based on user's primary group
1 个赞
顺便说一句,这看起来是问题的步骤?
Yarn 根本就不应该运行?
(PS:当你花 15 分钟更新一个仓库,然后一些元问题却让你花费数小时的时候,你是不是很喜欢 )
这是您的问题:
从仓库中删除您的 yarn.lock 文件,但保留(并更新!)您的 pnpm-lock.yaml 文件。
额外加分项 理想情况下,这应该是一个 PR,这样您的主分支就不会出现 CI 失败。
2 个赞
pfaffman
(Jay Pfaffman)
2025 年6 月 1 日 17:46
5
这是真的。我开始尝试记住这样做;它还没有自动化。我现在大约有 30% 的时间会这样做。
现在我遇到了这个:
运行 pnpm install --frozen-lockfile
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH 无法继续冻结安装。当前的“settings.autoInstallPeers”配置与锁定文件中找到的值不匹配
使用“pnpm install --no-frozen-lockfile”更新您的锁定文件
所以我按照它说的做了,现在我得到了:
运行 bundle install
请不要以 root 用户身份运行 Bundler。以 root 用户身份安装 bundle 会破坏此
应用程序在所有非 root 用户在此计算机上的使用。
找不到 Gemfile
但当我这样做时:
(main *) pfaffman@noreno:~/src/pfaffman/discourse-custom-homepage-for-groups$ cp ~/src/discourse-repos/discourse-theme-skeleton/pnpm-lock.yaml .
(main *) pfaffman@noreno:~/src/pfaffman/discourse-custom-homepage-for-groups$ git add pnpm-lock.yaml
(main +) pfaffman@noreno:~/src/pfaffman/discourse-custom-homepage-for-groups$ git commit -m 'their pnpm lock'
[main e195a2e] their pnpm lock
1 file changed, 1 insertion(+), 1 deletion(-)
(main) pfaffman@noreno:~/src/pfaffman/discourse-custom-homepage-for-groups$ git push
并且我确信他们的仓库是最新的。
看?它甚至提醒我,我在主分支上不负责任地工作。
猜测这只是一个过时的 pnpm-lock 文件……在目录中运行安装。
pfaffman
(Jay Pfaffman)
2025 年6 月 1 日 17:52
7
但是,当我运行 pnpm install --no-frozen-lockfile 并使用新的锁文件时,GitHub 给出了 bundler 错误。我应该可以使用 discourse-theme-skeleton 中的那个,对吧?
pfaffman
(Jay Pfaffman)
2025 年6 月 1 日 18:03
9
等等。Gemfile 是用于 Ruby 的,对吧?
但是在这里:
pfaffman@noreno:~$ cd src/discourse-repos/discourse-theme-skeleton/
(main) pfaffman@noreno:~/src/discourse-repos/discourse-theme-skeleton$ cp pnpm-lock.yaml Gemfile.lock Gemfile package.json stylelint.config.mjs ~/src/pfaffman/discourse-custom-homepage-for-groups/
这些是我们需要的,对吧?结果发现 stylelint.config.mjs 已经过时了,所以这算是一个发现。
无论如何,我仍然有
ERR_PNPM_LOCKFILE_CONFIG_MISMATCH 无法继续冻结安装。当前的 "settings.autoInstallPeers" 配置与锁文件中找到的值不匹配