为什么我的.tar文件会产生数百个PaxHeader文件?

时间:2016-06-17 20:33:38

标签: node.js deployment tar octopus

我正在设置AutoCI - >詹金斯 - >八达通自动化构建过程。我使用一个名为octopackjs& amp; gulp-octo将我的node.js项目打包成一个.tar文件,如下所示:

return gulp.src(['**/*', '!gulpfile.js'])
      .pipe(octo.pack("tar.gz"))
      .pipe(octo.push({apiKey: 'API-SUPERCOOLKEY', host: 'https://octopus.supercooldomain.net', replace: true}));

我可以收拾它,然后将它推到Octopus服务器的正确位置。但是,当我检查该.tar文件的内容时,它会被数百个名为" PaxHeader"的文件污染。从一些环顾来看,该文件旨在包含.tar包的元数据。当Octopus尝试将该文件解压缩到我的目标环境时,它会抛出以下错误跟踪:

System.IO.IOException: Cannot create /home/opsteam/.octopus/Applications/OctopusServer/Dev.Corporate/webapp/2.0.10/PaxHeader because a file with the same name already exists.
09:46:34Error
  at System.IO.Directory.CreateDirectory (System.String path) <0x7fdc9e79db50 + 0x00167> in <filename unknown>:0 
09:46:34Error
  at SharpCompress.Reader.IReaderExtensions.WriteEntryToDirectory (IReader reader, System.String destinationDirectory, ExtractOptions options) <0x4033e800 + 0x00260> in <filename unknown>:0 
09:46:34Error
  at Calamari.Integration.Packages.TarPackageExtractor.Extract (System.String packageFile, System.String directory, Boolean suppressNestedScriptWarning) <0x4033b4f0 + 0x000f3> in <filename unknown>:0 
09:46:34Error
  at Calamari.Integration.Packages.GenericPackageExtractor.Extract (System.String packageFile, System.String directory, Boolean suppressNestedScriptWarning) <0x4033b4a0 + 0x0003b> in <filename unknown>:0 
09:46:34Error
  at Calamari.Deployment.Conventions.ExtractPackageConvention.Install (Calamari.Deployment.RunningDeployment deployment) <0x40335ac0 + 0x000bb> in <filename unknown>:0 
09:46:34Error
  at Calamari.Deployment.ConventionProcessor.RunInstallConventions () <0x4030aaa0 + 0x00065> in <filename unknown>:0 
09:46:34Error
  at Calamari.Deployment.ConventionProcessor.RunConventions () <0x4030a940 + 0x0001f> in <filename unknown>:0 

发生了什么事?为什么我的.tar文件有这些工件?

编辑:这些PaxHeader文件的内容,当以文本形式打开时,范围从项目中模块的package.json内容到随机许可信息,到目录,字符串列表等......

1 个答案:

答案 0 :(得分:0)

如同http://help.octopusdeploy.com/discussions/problems/46332-deploy-to-linux-centos7-deploy-failing下的最后一篇文章中所建议的那样,同样的问题以及为我解决的问题是将npm升级到最新版本(目前为3.10.7)。

不确定您是Windows还是Windows,但我按照此SO帖子的建议使用了npm-windows-upgrade:How do I update node and npm on windows?

然后刷新所有node_modules并在项目上执行新的npm install。结果存档不仅现在不包含重复的PaxHeader文件,而且生成速度也更快。