首页 > 解决方案 > exec:不存在(没有这样的文件或目录)

问题描述

我正在将 WSL 与 docker 一起使用(具有复杂的 pandoc 配置,带有乳胶、python 和 pandoc-filters)并尝试使用长命令--filter=filters/the_filter.sh导致错误:

Error running filter filters/the_filter.sh: ./filters/the_filter.sh: createProcess: runInteractiveProcess: exec: does not exist (No such file or directory)

我的过滤器是一个.sh包装器,主要是为了确保我使用的是 Python3(可能不需要,但我从这里得到了提示):

#!/bin/sh
python3 filters/the_filter.py $@

谷歌搜索错误显示了很多 GitHub 问题,但没有关于堆栈溢出的明确解释。

标签: dockerwindows-subsystem-for-linuxpandoc

解决方案


事实证明,我的.sh文件有 Windows 行结尾:\r\n. 我假设系统正在尝试查找/bin/sh\r,但错误消息没有解释它。

使用 更正行尾dos2unix filters/the_filter.sh,我能够摆脱错误。

以下是相关问题的更多详细信息。


推荐阅读