Azure Webjob System.IO.PathTooLongException

我正在尝试在Azure网站上部署一个On Demand node.js WebJob,它使用了一些节点库,但每次运行都会产生错误

Failed to copy job files: 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. 

拿出图书馆补救错误,但是我不能运行WebJob。 我如何解决这个问题?

这是WebJobs / node.js / Windows目前已知的限制。

由于WebJob是从临时目录(它有一个已经很长的path启动)运行,并且在某些情况下,node_modules倾向于具有较长的依赖性树,而这些依赖性树的path长度和path长度受窗口限制。

解决方法:

  1. 删除path最长的文件,通常它们是testing相关的,不会影响你的脚本。
  2. 如果您使用npm安装,您可以尝试使用npm的重复数据删除,可以帮助( https://www.npmjs.org/doc/cli/npm-dedupe.html )。