# yarn 오류로 재구축 실패

**URL:** https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189
**Category:** Self-hosting
**Created:** [7월 19, 2023, 8:51오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189 "2023-07-19T20:51:04Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 19, 2023, 8:51오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/1 "2023-07-19T20:51:04Z")

</div>

Ubuntu 22.04에서 `./launcher rebuild app`를 실행하여 인스턴스를 업그레이드할 때 오류가 발생합니다. 제 판단으로는 문제가 여기서 시작됩니다:

```plaintext
error /var/www/discourse/app/assets/javascripts/node_modules/discourse: Command failed.
Exit code: 1
Command: yarn --silent --cwd .. patch-package
Arguments: 
Directory: /var/www/discourse/app/assets/javascripts/node_modules/discourse
Output:
error Command "patch-package" not found.
error Command failed with exit code 1.

```

위에는 몇 가지 “\_ has unmet peer dependency” 경고가 있지만, 이것은 첫 번째 오류입니다(DB 설정 시 “\_ already exists” 메시지는 예상되는 동작으로 알고 있습니다).

불행히도 이 문제가 처음 발생한 업그레이드는 가족과 함께 자동차 여행을 떠나기 하루 전이어서, 급하게 처리해야 했고 당시에는 디버깅할 시간이 없었습니다. 하지만 지금은 일관되게 이 오류가 발생하고 있습니다. 호스트는 최신 상태로 업데이트되어 있으며, 설정에 대해 특별히 이례적인 작업을 했다는 기억은 없습니다. 약 3개월 전 `/var/discourse`를 별도의 Digital Ocean 볼륨에 배치한 적은 있습니다(성능상의 이유로 권장되지 않는다는 것은 알고 있지만, 사용자들이 한 명뿐인 포럼에서는 그만한 트레이드오프가 괜찮을 것 같았습니다)만, 그 변경 이후로는 문제없이 작동한 것으로 보입니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [7월 19, 2023, 9:54오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/2 "2023-07-19T21:54:56Z")

</div>

그건 전부 경고일 뿐이라고 생각합니다.

사이트가 다시 올라오지 않았다면 다음을 시도해 보세요.

`./launcher start app`

---

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 19, 2023, 10:24오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/3 "2023-07-19T22:24:05Z")

</div>

`./launcher start app`를 실행했는데 이제 HTTP 502 오류가 발생합니다. `./launcher logs app`를 확인해 보니 다음과 같은 내용이 표시됩니다.

```plaintext
[Wed 19 Jul 2023 10:18:34 PM UTC] Run reload cmd: sv reload nginx
fail: nginx: runsv not running
[Wed 19 Jul 2023 10:18:34 PM UTC] Reload error for :
Started runsvdir, PID is 530
ok: run: redis: (pid 542) 0s
ok: run: postgres: (pid 543) 0s
supervisor pid: 538 unicorn pid: 569
Could not find rtlcss-0.2.1, mini_racer-0.8.0, puma-6.3.0, msgpack-1.7.1, libv8-node-18.16.0.0-x86_64-linux in locally installed gems
Run `bundle install` to install missing gems.
config/unicorn_launcher: line 71: kill: (569) - No such process
config/unicorn_launcher: line 15: kill: (569) - No such process
(538) exiting

```

이 내용이 꽤 많이 반복됩니다.

---

<div class="post-metadata">

### Author: ![Firepup650](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/firepup650/32/465200_2.png) [@Firepup650](https://meta.discourse.org/u/Firepup650)
#### Post date: [7월 19, 2023, 11:12오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/4 "2023-07-19T23:12:24Z")

</div>

> [@bcotton](#):
>
> ```plaintext
> 누락된 gem을 설치하려면 `bundle install`을 실행하세요.
> 
> ```

`bundle install`을 실행해 볼까요?

---

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 20, 2023, 12:02오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/5 "2023-07-20T00:02:36Z")

</div>

이를 위해 컨테이너에 진입해야 합니다. 그렇게 했다가 컨테이너를 다시 시작하면 웹 인터페이스에 다음과 같은 오류가 표시됩니다.

```plaintext
Oops

이 토론 포럼을 구동하는 소프트웨어에서 예상치 못한 문제가 발생했습니다. 불편을 드려 죄송합니다.

오류에 대한 자세한 정보는 기록되었고, 자동 알림이 생성되었습니다. 확인하겠습니다.

추가 조치는 필요하지 않습니다. 다만, 오류 상태가 지속되면 오류 재현 단계를 포함한 추가 정보를 사이트의 피드백 카테고리에 토론 주제를 게시하여 제공할 수 있습니다.

```

`./launcher logs app`를 실행하면 다음과 같은 결과가 나옵니다.

```plaintext
[Wed 19 Jul 2023 11:52:05 PM UTC] Domains not changed.
[Wed 19 Jul 2023 11:52:05 PM UTC] Skip, Next renewal time is: 2023-08-21T00:34:21Z
[Wed 19 Jul 2023 11:52:05 PM UTC] Add '--force' to force to renew.
[Wed 19 Jul 2023 11:52:05 PM UTC] Installing key to: /shared/ssl/distroleaders.club_ecc.key
[Wed 19 Jul 2023 11:52:05 PM UTC] Installing full chain to: /shared/ssl/distroleaders.club_ecc.cer
[Wed 19 Jul 2023 11:52:05 PM UTC] Run reload cmd: sv reload nginx
fail: nginx: runsv not running
[Wed 19 Jul 2023 11:52:05 PM UTC] Reload error for :
Started runsvdir, PID is 530
ok: run: redis: (pid 544) 0s
ok: run: postgres: (pid 543) 0s
supervisor pid: 538 unicorn pid: 575

```

다시 컨테이너에 진입하면 `sv reload nginx`를 성공적으로 실행할 수 있지만, 이는 동작 방식을 변경하지 않습니다.

또한, `./launcher rebuild app`를 다시 실행하면 컨테이너에 다시 진입하여 `bundle install`을 다시 실행해야 합니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [7월 20, 2023, 1:04오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/6 "2023-07-20T01:04:27Z")

</div>

어딘가에 다른 오류가 있습니다. 전체 로그를 포함해 주세요.

비표준 플러그인을 사용하고 계신가요?

---

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 20, 2023, 1:36오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/7 "2023-07-20T01:36:33Z")

</div>

> [@pfaffman](#):
>
> 어딘가에 또 다른 오류가 있습니다. 전체 로그를 포함해 로그를 포함해 주세요.

- [`./launcher logs app` 출력](http://funnelfiasco.homelinux.com/temp-files/discourse-logs.txt)
- [`/tmp/discourse-debug` 내용 (`./discourse-doctor` 실행 결과)](http://funnelfiasco.homelinux.com/temp-files/discourse-debug.txt)

> [@pfaffman](#):
>
> 비표준 플러그인이 있나요?

기억이 나지 않습니다 (제가 보고 있지 않을 때 @mattdm이 몇 개를 몰래 넣은 것이 아니라면 😄 ). discourse-doctor 역시 "비공식 플러그인 감지 안 됨"이라고 표시합니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [7월 20, 2023, 1:38오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/8 "2023-07-20T01:38:17Z")

</div>

재빌드 시 전체 로그를 말하는 거였어요.

---

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 20, 2023, 1:47오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/9 "2023-07-20T01:47:29Z")

</div>

죄송합니다. 여기는 [재구축 결과물](http://funnelfiasco.homelinux.com/temp-files/discourse-rebuild.log)입니다. 이것이 찾으셨던 내용인가요?

---

<div class="post-metadata">

### Author: ![Falco](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/falco/32/179432_2.png) [@Falco](https://meta.discourse.org/u/Falco)
#### Post date: [7월 20, 2023, 2:38오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/10 "2023-07-20T02:38:03Z")

</div>

두 번째 줄이 모든 것을 말해 줍니다

```plaintext
fatal: not a git repository (or any parent up to mount point /var)

```

`/var/discourse` 디렉터리가 git 저장소가 아니기 때문에 launcher의 자동 업데이트와 Discourse 부팅에 사용하는 도구들이 손상되며, 그 결과 오래된 docker 이미지에 머물러 있게 됩니다.

그것을 깨뜨린 변경 사항을 되돌려야 합니다.

---

<div class="post-metadata">

### Author: ![pfaffman](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/pfaffman/32/120154_2.png) [@pfaffman](https://meta.discourse.org/u/pfaffman)
#### Post date: [7월 20, 2023, 9:14오전 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/11 "2023-07-20T09:14:11Z")

</div>

> [@Falco](#):
>
> `/var/discourse` 디렉터리가 git 저장소가 아니기 때문에 launcher의 자동 업데이트가 중단되었습니다.

파일을 볼륨으로 복사할 때 `.git`을 복사하지 못했습니다. 따라서 해당 저장소를 클론하고 나머지 파일을 그 안으로 복사해야 합니다.

볼륨에는 업로드 파일만 보관하는 것이 좋습니다. 용량의 대부분을 차지하는 것이 업로드 파일일 것으로 예상되며, 이렇게 하면 볼륨에 업로드 파일과 백업만 유지할 수 있습니다.

---

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 20, 2023, 1:33오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/12 "2023-07-20T13:33:49Z")

</div>

> [@Falco](#):
>
> `/var/discourse` 디렉터리가 git 저장소가 아니므로, launcher의 자동 업데이트와 Discourse를 부트스트랩하는 데 사용되는 도구가 깨지며, 이로 인해 오래된 docker 이미지에 머물러 있게 됩니다.

아, 정말로요. 제가 정확히 무엇을 잘못했는지 추측할 수 있을 것 같은데, rsync 명령어에서 `*`가 `.git`를 매칭하지 않는다는 사실과 관련이 있을 겁니다. rsync를 사용해 제 일을 더 어렵게 만든 첫 번째 경우는 아닐 텐데요. 그걸 알아봐 주셔서 감사합니다!

재구축이 그 지점에서 종료되지 않는 데에는 기술적인 이유가 있나요? 그렇게 했다면 문제 해결이 더 쉬웠을 것 같습니다(물론 위에서부터 시작하는 것도 도움이 되었겠지만요).

---

<div class="post-metadata">

### Author: ![bcotton](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/bcotton/32/205901_2.png) [@bcotton](https://meta.discourse.org/u/bcotton)
#### Post date: [7월 20, 2023, 1:37오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/13 "2023-07-20T13:37:07Z")

</div>

> [@pfaffman](#):
>
> 볼륨으로 파일을 복사할 때 `.git`를 복사하지 못했기 때문에, 클론을 다시 생성하고 나머지 항목들을 그곳으로 복사해야 합니다.

다행히도 지난 몇 년간 시스템 관리 능력을 _전부_ 잃어버린 것은 아니어서, 마이그레이션 이전의 tarball 파일을 아직 가지고 있습니다. 😄

> [@pfaffman](#):
>
> 볼륨에는 업로드 파일만 있는 것이 좋습니다. 아마도 공간의 대부분을 차지하는 것이 업로드일 것이라고 추측하며, 그렇게 하면 볼륨에 업로드와 백업만 두면 됩니다.

이것은 가장 작은 Digital Ocean 드롭렛이므로, 공간을 대부분 차지하는 것은 시스템입니다. 업로드와 백업을 합쳐도 약 100MB에 불과합니다. 변경을 하게 된다면, 디스크 공간이 더 큰 더 큰 드롭렛으로 이동하는 것으로 결정할 것 같습니다.

도움 주셔서 감사합니다. 정말 감사드립니다!

---

<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: [8월 19, 2023, 1:37오후 UTC](https://meta.discourse.org/t/rebuild-fails-with-yarn-errors/272189/14 "2023-08-19T13:37:42Z")

</div>

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