VS2017 - Ionic/Cordova - 无法构建 iOS RemoteBuild - 路径太长

Posted

技术标签:

【中文标题】VS2017 - Ionic/Cordova - 无法构建 iOS RemoteBuild - 路径太长【英文标题】:VS2017 - Ionic/Cordova - Unable to build iOS RemoteBuild - Path too long 【发布时间】:2017-03-17 16:05:45 【问题描述】:

我最近从 VS2015 升级到 VS2017,现在无法为 ios 构建我的 Ionic Cordova 项目。

我可以很好地为 android 构建。

我复制了 iOS 远程构建设置(并检查了它在我的 Mac 上运行的服务器等),但是当我尝试构建时,我收到以下错误:

1>------ Build started: Project: PROJECTNAME, Configuration: Debug iOS ------
Cordova 6.3.1
------ Platform ios already exists
 ____                      _       _           _ _     _ 
|  _ \ ___ _ __ ___   ___ | |_ ___| |__  _   _(_) | __| |
| |_) / _ \ '_ ` _ \ / _ \| __/ _ \ '_ \| | | | | |/ _` |
|  _ <  __/ | | | | | (_) | ||  __/ |_) | |_| | | | (_| |
|_| \_\___|_| |_| |_|\___/ \__\___|_.__/ \__,_|_|_|\__,_|

-----------------------------------------------------------------------------
Sending the build to the remote build server
-----------------------------------------------------------------------------
------ Incremental Build: False
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(256,5): error MSB4018: The "VsTac" task failed unexpectedly.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(256,5): error MSB4018: System.IO.PathTooLongException: The specified path, file name, or both are too long. The fully qualified file name must be less than 260 characters, and the directory name must be less than 248 characters.
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Microsoft\VisualStudio\v15.0\ApacheCordovaTools\vs-mda-targets\Microsoft.MDA.FileMirroring.targets(256,5): error MSB4018:    at System.IO.PathHelper.GetFullPathName()

我在没有运行远程构建代理的情况下对此进行了测试,但它仍然失败,所以我怀疑这与我的 Windows 机器有关。但是,由于 Android 构建良好,我不确定。

我不确定从这里尝试什么;不知道如何进一步调试。

有什么想法吗?

【问题讨论】:

您可以尝试将您的项目移近驱动器的根目录吗?这可能会解决它。 @MichaelBraude,我会试试这个并告诉你。 这不是 2017 年的问题 - 我在 2015 年看到它的路径很长,@MichaelBraude 的回答将根据我的经验工作 【参考方案1】:

这可能是因为您的项目具有带有长嵌套文件路径的 npm 包。远程构建无法复制它们,因为它们超出了 Windows 的 max_path 限制。

将项目移近驱动器的根目录应该可以解决问题。

【讨论】:

是的,就是这样 - 我尝试将我的项目移动到 C:\ 驱动器,但没有成功。然后我意识到 [github.com/npm/npm/releases/tag/v3.0.0](node3.x 改变了 node_modules 文件夹的填充方式)解决了问题。

以上是关于VS2017 - Ionic/Cordova - 无法构建 iOS RemoteBuild - 路径太长的主要内容,如果未能解决你的问题,请参考以下文章

混合式移动应用开发浅析之Ionic/Cordova vs React Native

升级到 Ionic 1.3 后,Ionic/Cordova 联系人插件在 iOS 上返回 Invalid Date

IONIC/Cordova 视频流

当应用不在前台时,Ionic / Cordova 触发应用操作

Ionic/Cordova - 为啥在提交 git 时忽略 node_modules?

Ionic / Cordova和Android 64位要求