Windows 上的 AzerothCore Docker:'\r':找不到命令

问题描述

尝试在 Windows 上运行 AzerothCore using Docker 时出现此错误

Step 9/15 : RUN ./azerothcore/bin/acore-db-asm 1
 ---> Running in 17cc370dcab8
/azerothcore/apps/db_assembler/includes/../../bash_shared/includes.sh: line 2: $'\r': command not found
ERROR: Service 'ac-database' Failed to build : The command '/bin/sh -c ./azerothcore/bin/acore-db-asm 1' returned a non-zero code: 127

AzerothCore error Docker on Windows

解决方法

问题是使用不同于 End of line sequence(Unix 格式)的 LF 保存文件。

所以要解决这个问题,用编辑器打开出错的文件(例如.../bash_shared/include.sh),并确保它使用LF正确保存(因为CRLF或其他格式会破坏它)。

例如,使用 Visual Studio Code 打开文件,然后将格式更改为 LF:

vscode change CRLF to LF

vscode save LF

选择 LF 并保存。这应该可以解决问题。

对于 Visual Studio,请阅读:https://docs.microsoft.com/en-us/visualstudio/ide/encodings-and-line-breaks?view=vs-2019