Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/swift/17.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/css/40.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Swift测试失败,出现“错误”;模块映射文件";不时出错_Swift_Server_Ubuntu 16.04 - Fatal编程技术网

Swift测试失败,出现“错误”;模块映射文件";不时出错

Swift测试失败,出现“错误”;模块映射文件";不时出错,swift,server,ubuntu-16.04,Swift,Server,Ubuntu 16.04,我正在Ubuntu 16.04上使用Swift 4.0.2进行开发(在Docker容器下)。我使用脚本在命令行上运行了一系列Swift测试(使用Swift test…)。命令行示例如下: swift test -Xswiftc -DDEBUG -Xswiftc -DSERVER -Xswiftc -DPRIMARY_OWNING_GOOGLE1 --filter ServerTests.UserControllerTests 为了完整起见,下面是我用来运行测试的脚本: 在测试之间,我的脚本使

我正在Ubuntu 16.04上使用Swift 4.0.2进行开发(在Docker容器下)。我使用脚本在命令行上运行了一系列Swift测试(使用
Swift test
…)。命令行示例如下:

swift test -Xswiftc -DDEBUG -Xswiftc -DSERVER -Xswiftc -DPRIMARY_OWNING_GOOGLE1 --filter ServerTests.UserControllerTests
为了完整起见,下面是我用来运行测试的脚本:

在测试之间,我的脚本使用
swift-package-clean
清理构建产品。然而,我有时会随机得到如下输出的测试失败:

<unknown>:0: error: module map file '/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found <unknown>:0: error: module map file 
'/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found <unknown>:0: error: module map file 
'/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found <unknown>:0: error: module map file 
'/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "/root/Apps/SyncServerII/SyncServerII/.build/checkouts/Kitura-net.git-7914159224218470268/Sources/CHTTPParser/include/CHTTPParser.h"
         ^ /root/Apps/SyncServerII/SyncServerII/.build/checkouts/Kitura-net.git-7914159224218470268/Sources/CHTTPParser/include/CHTTPParser.h:21:10: error: 'utils.h' file not found
#include "utils.h"
         ^ /root/Apps/SyncServerII/SyncServerII/.build/checkouts/Kitura-net.git-7914159224218470268/Sources/KituraNet/HTTPParser/HTTPParser.swift:17:8: error: could not build C module 'CHTTPParser' import CHTTPParser
       ^
:0:错误:未找到模块映射文件'/root/Apps/SyncServerII/SyncServerII/.build/checkout/CCurl.git--3354261816655650653/module.modulemap':0:错误:模块映射文件
未找到“/root/Apps/SyncServerII/SyncServerII/.build/checkout/CCurl.git--3354261816655650653/module.modulemap”:0:错误:模块映射文件
未找到“/root/Apps/SyncServerII/SyncServerII/.build/checkout/CCurl.git--3354261816655650653/module.modulemap”:0:错误:模块映射文件
找不到“/root/Apps/SyncServerII/SyncServerII/.build/checkout/CCurl.git--3354261816655650653/module.modulemap”
或者像这样:

<unknown>:0: error: module map file '/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found <unknown>:0: error: module map file 
'/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found <unknown>:0: error: module map file 
'/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found <unknown>:0: error: module map file 
'/root/Apps/SyncServerII/SyncServerII/.build/checkouts/CCurl.git--3354261816655650653/module.modulemap' not found
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "/root/Apps/SyncServerII/SyncServerII/.build/checkouts/Kitura-net.git-7914159224218470268/Sources/CHTTPParser/include/CHTTPParser.h"
         ^ /root/Apps/SyncServerII/SyncServerII/.build/checkouts/Kitura-net.git-7914159224218470268/Sources/CHTTPParser/include/CHTTPParser.h:21:10: error: 'utils.h' file not found
#include "utils.h"
         ^ /root/Apps/SyncServerII/SyncServerII/.build/checkouts/Kitura-net.git-7914159224218470268/Sources/KituraNet/HTTPParser/HTTPParser.swift:17:8: error: could not build C module 'CHTTPParser' import CHTTPParser
       ^
:1:10:注意:在包含的文件中:1:
#包括“/root/Apps/SyncServerII/SyncServerII/.build/checkout/Kitura net.git-7914159224218470268/Sources/CHTTPParser/include/CHTTPParser.h”
^/root/Apps/SyncServerII/SyncServerII/.build/checkout/Kitura net.git-7914159224218470268/Sources/CHTTPParser/include/CHTTPParser.h:21:10:错误:“未找到utils.h”文件
#包括“utils.h”
^/root/Apps/SyncServerII/SyncServerII/.build/checkout/Kitura net.git-7914159224218470268/Sources/KituraNet/HTTPParser/HTTPParser.swift:17:8:错误:无法生成C模块“CHTTPParser”导入CHTTPParser
^
请注意,这不是执行测试的问题,而是Swift工具在准备运行测试时生成代码时出现的问题


我可以在
swift test
调用之间删除整个build products目录(.build),但这会大大增加我的测试时间。有什么想法吗?谢谢。

可能与上述内容不完全相关,但如果您正在使用CocoaPods,并且任何pod依赖项都会出现“模块映射文件”错误,请尝试更新到较新的CocoaPods版本。首先用
pods--version
检查你的版本,然后用
sudogem安装cocoapods

找到答案了吗?没有明确的答案。考虑到我已经改用了
Swift版本4.1.2(Swift-4.1.2-RELEASE)
,这种情况似乎不太常见(根本不是吗?)。在我看来,这是“纯粹的”Swift,与Xcode和iOS应用程序是分开的。在Linux下运行。请看我的原始问题(Docker,Ubuntu)。