테마 컴포넌트 저장소에서 pnpm으로 node_modules를 설치한 상태에서 Discourse Theme CLI를 실행하면, discourse_theme watch . 명령을 사용할 때 node_modules/.pnpm 디렉토리가 이미 감시(watch)되고 있다는 오류가 반환됩니다. 대략적으로 살펴보면, 이는 패키지가 심볼릭 링크로 연결되어 있기 때문으로 보입니다.
공식 mermaid TC를 사용하여 discourse_theme v2.1.3으로 새 GitHub Codespace에서 이 문제를 테스트했습니다.
오류 로그 발췌
** ERROR: directory is already being watched! **
Directory: /workspaces/discourse-mermaid-theme-component/node_modules/.pnpm/ember-template-recast@6.1.5/node_modules/@glimmer/reference
is already being watched through: /workspaces/discourse-mermaid-theme-component/node_modules/.pnpm/@glimmer+reference@0.84.3/node_modules/@glimmer/reference
MORE INFO: https://github.com/guard/listen/blob/master/README.md
** ERROR: directory is already being watched! **
Directory: /workspaces/discourse-mermaid-theme-component/node_modules/.pnpm/@humanwhocodes+retry@0.3.1/node_modules/@humanwhocodes/retry
is already being watched through: /workspaces/discourse-mermaid-theme-component/node_modules/.pnpm/@humanwhocodes+retry@0.3.1/node_modules/@humanwhocodes/retry
MORE INFO: https://github.com/guard/listen/blob/master/README.md
이는 discourse_theme가 node_modules/.pnpm이나 일반적인 node_modules에 대한 무시(ignore) 설정 없이 전체 디렉토리를 감시하고 있기 때문일 것으로 추정됩니다.
보통 로컬 개발 인스턴스, 내 컴퓨터가 아닌 개발용 포럼 복사본, 또는 Theme Creator 사이트(최근 API 키 생성기가 작동하지 않는 것 같습니다) 중 하나를 대상으로 테마를 개발/테스트하기 때문에, TC 디렉터리 내부에서 직접 사용합니다. 어떤 환경에서 작업하고 있는지 혼동하는 것을 피하려는 것입니다.
mermaid TC를 새로운 discourse codespace 설치와 동일한 codespace에 git clone으로 가져오고, discourse 디렉터리에서 대신 discourse_theme watch를 실행해 보았습니다. 동일한 오류가 발생합니다.
물론 그건 자의적이긴 하지만, 테스트 중인 discourse 인스턴스가 로컬 인스턴스가 아닌데 discourse_theme를 discourse의 로컬 클론에서 실행해야 하는 건 좀 터무니없어.
어쨌든, 당신이 제안한 대로 새 GitHub Codespace와 내 자체 개발 환경 모두에서 시도해 보았지만, 여전히 동일한 오류가 발생해.
로그 전체(또는 터미널 히스토리에 들어가는 모든 로그)를 살펴보니, 오류가 발생하는 디렉터리는 모두 /node_modules/.pnpm이야. pnpm 대신 yarn을 사용하도록 아직 업데이트되지 않은 다른 TC(테마 컬렉션)에 대해 discourse_theme를 테스트하고 실행해 보았을 때, 어떤 오류도 보이지 않았어. 그래서 이 문제가 .pnpm을 관찰(watching)하는 것과 관련이 있다고 거의 100% 확신해.
Symlinked `node_modules` structure | pnpm 에 따르면, node_modules의 일반 구조는 실제 코드를 모두 /node_modules/.pnpm으로 이동시키고, /node_modules/의 나머지 디렉터리들은 .pnpm으로 향하는 심볼릭 링크일 뿐이므로 유지된다고 해. 따라서 .pnpm을 무시하면 “directory is already being watched!”(디렉터리가 이미 관찰 중입니다!) 오류를 피할 수 있어.
discourse_theme 지엠(gem)을 조금 만져 보고 watcher.rb에 listener.ignore /node_modules\/\.pnpm/를 추가했는데, 오류 메시지 없이 잘 작동하는 것 같아. 심지어 새로운 pnpm 패키지 설치도 감지했어.