

Amazon CodeCatalyst 不再向新客戶開放。現有客戶可以繼續正常使用該服務。如需詳細資訊，請參閱[如何從 CodeCatalyst 遷移](migration.md)。

本文為英文版的機器翻譯版本，如內容有任何歧義或不一致之處，概以英文版為準。

# 對 devfile 的問題進行故障診斷
<a name="devenvironments-devenvironments-devfile"></a>

請參閱下列各節，以疑難排解 CodeCatalyst 中與 devfile 相關的問題。如需 devfile 的詳細資訊，請參閱 [設定開發環境的 devfile](devenvironment-devfile.md)。

**Topics**
+ [我的開發環境使用預設通用 devfile，即使已在自訂 devfile 中實作自訂映像](#troubleshooting-devenvironments-custom-image)
+ [我的專案並未使用預設通用 devfile 在我的開發環境中建置](#troubleshooting-devenvironments-default-image)
+ [我想要移動開發環境的儲存庫 devfile](#troubleshooting-devenvironments-devfile-moving)
+ [我在啟動我的 devfile 時遇到問題](#troubleshooting-devenvironments-devfile-recovery)
+ [我不確定如何檢查我的 devfile 狀態](#troubleshooting-devenvironments-devfile-status)
+ [我的 devfile 與最新映像中提供的工具不相容](#troubleshooting-devenvironments-devfile-version)

## 我的開發環境使用預設通用 devfile，即使已在自訂 devfile 中實作自訂映像
<a name="troubleshooting-devenvironments-custom-image"></a>

如果 CodeCatalyst 在啟動使用自訂 devfile 的開發環境時發生錯誤，則開發環境預設為預設的通用 devfile。若要修正問題，您可以在 下的日誌中檢查確切錯誤`/aws/mde/logs/devfile.log`。您也可以檢查日誌中的`postStart`執行是否成功：`/aws/mde/logs/devfileCommand.log`。

## 我的專案並未使用預設通用 devfile 在我的開發環境中建置
<a name="troubleshooting-devenvironments-default-image"></a>

修正您未使用自訂 devfile 的問題檢查。如果您不是使用自訂 devfile，請在專案的來源儲存庫中檢視 `devfile.yaml` 檔案，以尋找並修正任何錯誤。

## 我想要移動開發環境的儲存庫 devfile
<a name="troubleshooting-devenvironments-devfile-moving"></a>

您可以將預設 devfile `/projects/devfile.yaml` 移入原始程式碼儲存庫。若要更新 devfile 的位置，請使用下列命令：`/aws/mde/mde start --location repository-name/devfile.yaml`。

## 我在啟動我的 devfile 時遇到問題
<a name="troubleshooting-devenvironments-devfile-recovery"></a>

如果啟動您的 devfile 時發生問題，它會進入復原模式，以便您仍然可以連線到您的環境並修正您的 devfile。在復原模式中，執行 `/aws/mde/mde status`不會包含您 devfile 的位置。

```
{
    "status": "STABLE"
}
```

您可以在 下的日誌中檢查錯誤`/aws/mde/logs`、修正 devfile，然後再試一次`/aws/mde/mde start`。

## 我不確定如何檢查我的 devfile 狀態
<a name="troubleshooting-devenvironments-devfile-status"></a>

您可以執行 來檢查您的 devfile 狀態`/aws/mde/mde status`。執行此命令後，您可能會看到下列其中一項：
+ `{"status": "STABLE", "location": "devfile.yaml" }`

  這表示您的 devfile 正確。
+ `{"status": "STABLE" }`

  這表示您的 devfile 無法啟動，並已進入復原模式。

您可以在 下的日誌中檢查確切錯誤`/aws/mde/logs/devfile.log`。

您也可以檢查日誌中的`postStart`執行是否成功：`/aws/mde/logs/devfileCommand.log`。

如需詳細資訊，請參閱[指定開發環境的通用 devfile 映像](devenvironment-universal-image.md)。

## 我的 devfile 與最新映像中提供的工具不相容
<a name="troubleshooting-devenvironments-devfile-version"></a>

在您的開發環境中，如果`latest`工具沒有特定專案所需的工具，則 `devfile`或 `devfile postStart`可能會失敗。若要修正問題，請執行下列動作：<a name="devenvironment-devfile-version"></a>

1. 導覽至您的 devfile。

1. 在您的 devfile 中，更新為精細影像版本，而非 `latest`。它看起來可能會類似以下內容：

   ```
   components:
     - container:
         image: public.ecr.aws/amazonlinux/universal-image:1.0
   ```

1. 使用更新的 devfile 建立新的開發環境。