“JS 의존성 설치” 단계에서 테마 린트 오류 발생

최신 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를 로컬에서 실행하려는 시도에서는 린팅이 작동하지만, 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.

이것은 “install JS Dependencies” 단계에서 발생하는 것이므로, 제가 한 일 때문에 이런 문제가 생기는 것 같지는 않습니다.

제 코드입니다: GitHub - pfaffman/discourse-custom-homepage-for-groups: Discourse theme component to change home page based on user's primary group · GitHub

참고로, 이게 문제 단계로 보이나요?

Yarn은 아예 실행하면 안 되는 거 아닌가요?

(참고로, 리포지토리를 업데이트하는 데 15분이 걸리더니, 메타 이슈 때문에 몇 시간을 허비하게 될 때 정말 기분이 좋죠 :sweat_smile: )

이것이 당신의 문제입니다:

리포지토리에서 yarn.lock 파일을 삭제하되, pnpm-lock.yaml 파일은 남겨두고(업데이트하세요!)

보너스 포인트 :sports_medal: 이상적으로는 PR로 처리했어야 했는데, 그렇게 하지 않아 메인 브랜치에서 CI가 실패하고 있습니다.

맞아요. 그걸 기억하려고 노력하고 있지만, 아직 자동화되지는 않았거든요. 약 30%의 경우에만 그렇게 하고 있습니다. :slight_smile:


이제 이런 오류가 나요:

Run pnpm install --frozen-lockfile
 ERR_PNPM_LOCKFILE_CONFIG_MISMATCH  Cannot proceed with the frozen installation. The current "settings.autoInstallPeers" configuration doesn't match the value found in the lockfile

Update your lockfile using "pnpm install --no-frozen-lockfile"

그래서 지시대로 했더니, 이번에는 이런 오류가 나요:

Run bundle install
Don't run Bundler as root. Installing your bundle as root will break this
application for all non-root users on this machine.
Could not locate 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 파일 때문인 것 같습니다 … 해당 디렉터리에서 설치를 실행해 보세요.

하지만 pnpm install --no-frozen-lockfile를 실행한 후 새로운 lock 파일을 사용했을 때, GitHub에서 bundler 오류가 발생했습니다. discourse-theme-skeleton에 있는 것을 사용해도 되는 거죠, 맞죠?

Gemfile를 추가하세요

잠깐. 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  Cannot proceed with the frozen installation. The current "settings.autoInstallPeers" configuration doesn't match the value found in the lockfile

이 문제가 남아 있습니다.

아마도 모든 스펙을 위한 것인 것 같고, CI 스크립트에서 요구하는 파일입니다.