通过VSTS将webpack / npm部署到Windows vm失败

时间:2018-06-15 21:42:25

标签: node.js reactjs npm webpack azure-devops

我使用webpack创建了一个ReactJS应用程序,并通过npm / node构建它。这是我第一次使用这些技术,如果我使用错误的术语,请原谅我。我通过VSTS完成了持续集成构建。虽然构建工作相当大(我正在编写代码拆分)56Mb zip文件,但构建工作正常。问题是当我去部署它时。我再次使用VSTS将其部署到Azure上托管的Windows VM上的IIS。我得到的错误告诉我什么,我无法在任何地方找到任何信息来帮助我。这是我的错误:

  

2018-06-15T05:08:04.6837965Z   ================================================== ============================ 2018-06-15T05:08:04.6838094Z任务:IIS Web App部署   2018-06-15T05:08:04.6838179Z描述:部署网站或Web   使用WebDeploy的应用程序2018-06-15T05:08:04.6838275Z版本
  :0.0.39 2018-06-15T05:08:04.6838346Z作者:微软   公司2018-06-15T05:08:04.6838452Z帮助:More Information   2018-06-15T05:08:04.6838542Z   ================================================== ============================ 2018-06-15T05:08:32.0782958Z ## [错误]退出代码-529697949返回   来自进程:文件名' C:\ VSTSAgent \ externals \ node \ bin \ node.exe',   参数   '" C:\ VSTSAgent_work_tasks \ IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-ACCD-886174c09bba \ 0.0.39 \ deployiiswebapp.js"'

这个错误可能是由于尺寸造成的吗?还有一点需要注意。 Microsoft文档显示使用Gulp构建应用程序,我使用npm,所以不确定这是否有所作为。无论如何,根据所有帐户和每个Microsoft,我应该能够轻松地将其部署到我的VM和IIS。任何帮助将不胜感激。

如果需要,这是我的webpack.config.js:

var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');

module.exports = {
    entry: {
      app: ["./src/index.jsx"],
      silentRenew: ["./silent_renew/index.js"]
    },
    context: path.resolve(__dirname, "."),
    output: {
      path: path.join(__dirname, "dist"),
      filename: "[name].js",
      chunkFilename: "[name].chunk.js"
    },
    resolve: {
        extensions: ['.js', '.jsx']
    },
    module: {
      rules: [
          {
              test: /\.jsx?$/,
              exclude: /(node_modules|bower_components)/,
              loader: 'babel-loader',
              query: {
                  presets: ['react', 'es2015', 'stage-3']
              }
          },
          {
              test: /\.css$/,
              loader: ['style-loader', 'css-loader']
          },
          {
              test: /\.(eot|svg|ttf|woff|woff2)$/,
              loader: 'file?name=public/fonts/[name].[ext]'
          }
      ]
    },
    externals: {
      'Config': JSON.stringify(require('./config.json'))
    },
    plugins: [
      new HtmlWebpackPlugin({
        template: './src/index.html',
        filename: 'index.html',
        inject: 'body'
      }),
      new HtmlWebpackPlugin({
        template: "./silent_renew/silent_renew.html",
        filename: "silent_renew.html",
        inject: 'body',
      })
    ],
    devServer: {
        historyApiFallback: true
    }
}

编辑(添加详细调试日志):

  

2018-06-18T14:51:49.9481397Z ##[debug]Evaluating condition for step:
> 'Deploy Client' 2018-06-18T14:51:49.9483383Z ##[debug]Evaluating:
> succeeded() 2018-06-18T14:51:49.9483610Z ##[debug]Evaluating
> succeeded: 2018-06-18T14:51:49.9483969Z ##[debug]=> True
> 2018-06-18T14:51:49.9484274Z ##[debug]Result: True
> 2018-06-18T14:51:49.9484678Z ##[section]Starting: Deploy Client
> 2018-06-18T14:51:49.9489876Z
> ============================================================================== 2018-06-18T14:51:49.9490039Z Task         : IIS Web App Deploy
> 2018-06-18T14:51:49.9490144Z Description  : Deploy a Website or Web
> Application using WebDeploy 2018-06-18T14:51:49.9490246Z Version     
> : 0.0.39 2018-06-18T14:51:49.9490361Z Author       : Microsoft
> Corporation 2018-06-18T14:51:49.9490493Z Help         : [More
> Information](https://go.microsoft.com/fwlink/?linkid=866789)
> 2018-06-18T14:51:49.9490607Z
> ============================================================================== 2018-06-18T14:51:52.6671876Z
> ##[debug]agent.workFolder=C:\VSTSAgent\_work 2018-06-18T14:51:52.6814149Z ##[debug]loading inputs and endpoints
> 2018-06-18T14:51:52.6814411Z ##[debug]loading
> ENDPOINT_AUTH_PARAMETER_SYSTEMVSSCONNECTION_ACCESSTOKEN
> 2018-06-18T14:51:52.6814591Z ##[debug]loading
> ENDPOINT_AUTH_SCHEME_SYSTEMVSSCONNECTION 2018-06-18T14:51:52.6814783Z
> ##[debug]loading ENDPOINT_AUTH_SYSTEMVSSCONNECTION 2018-06-18T14:51:52.6814948Z ##[debug]loading
> INPUT_EXCLUDEFILESFROMAPPDATAFLAG 2018-06-18T14:51:52.6815124Z
> ##[debug]loading INPUT_PACKAGE 2018-06-18T14:51:52.6815285Z ##[debug]loading INPUT_REMOVEADDITIONALFILESFLAG 2018-06-18T14:51:52.6815445Z ##[debug]loading INPUT_SETPARAMETERSFILE
> 2018-06-18T14:51:52.6816129Z ##[debug]loading INPUT_TAKEAPPOFFLINEFLAG
> 2018-06-18T14:51:52.6816253Z ##[debug]loading INPUT_WEBSITENAME
> 2018-06-18T14:51:52.6816390Z ##[debug]loading INPUT_XMLTRANSFORMATION
> 2018-06-18T14:51:52.6816512Z ##[debug]loading
> INPUT_XMLVARIABLESUBSTITUTION 2018-06-18T14:51:52.6816628Z
> ##[debug]loaded 11 2018-06-18T14:51:53.7943817Z ##[debug]check path : C:\VSTSAgent\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.0.39\task.json
> 2018-06-18T14:51:53.7972514Z ##[debug]set resource file to:
> C:\VSTSAgent\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.0.39\task.json
> 2018-06-18T14:51:53.7972788Z ##[debug]system.culture=en-US
> 2018-06-18T14:51:53.8089699Z ##[debug]WebSiteName=Client
> 2018-06-18T14:51:53.8213309Z ##[debug]VirtualApplication=null
> 2018-06-18T14:51:53.8213582Z
> ##[debug]Package=C:\VSTSAgent\_work\r2\a\Nightly Build and Deploy\drop\Client.zip 2018-06-18T14:51:53.8213822Z
> ##[debug]SetParametersFile=C:\VSTSAgent\_work\r2\a 2018-06-18T14:51:53.8214026Z ##[debug]RemoveAdditionalFilesFlag=true
> 2018-06-18T14:51:53.8214217Z ##[debug]ExcludeFilesFromAppDataFlag=true
> 2018-06-18T14:51:53.8214376Z ##[debug]TakeAppOfflineFlag=true
> 2018-06-18T14:51:53.8214530Z ##[debug]AdditionalArguments=null
> 2018-06-18T14:51:53.8214710Z ##[debug]XmlTransformation=false
> 2018-06-18T14:51:53.8214877Z ##[debug]JSONFiles=null
> 2018-06-18T14:51:53.8215054Z ##[debug]XmlVariableSubstitution=false
> 2018-06-18T14:51:53.8215393Z ##[debug]Finding files matching input:
> C:\VSTSAgent\_work\r2\a\Nightly Build and Deploy\drop\Client.zip
> 2018-06-18T14:51:53.8758329Z
> ##[debug]SetParametersFile=C:\VSTSAgent\_work\r2\a 2018-06-18T14:51:53.8759197Z ##[debug]Absolute path for pathSegments:
> C:\VSTSAgent\_work\r2\a = C:\VSTSAgent\_work\r2\a
> 2018-06-18T14:51:53.8760607Z ##[debug]build.sourcesDirectory=undefined
> 2018-06-18T14:51:53.8761173Z
> ##[debug]system.defaultWorkingDirectory=C:\VSTSAgent\_work\r2\a 2018-06-18T14:51:54.2727713Z ##[debug]Absolute path for pathSegments:
> C:\VSTSAgent\_work\r2\a = C:\VSTSAgent\_work\r2\a
> 2018-06-18T14:51:54.4839589Z ##[debug]SetParametersFilepath supplied
> :false 2018-06-18T14:52:26.3782295Z ##[error]Exit code -529697949
> returned from process: file name
> 'C:\VSTSAgent\externals\node\bin\node.exe', arguments
> '"C:\VSTSAgent\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.0.39\deployiiswebapp.js"'.
> 2018-06-18T14:52:26.3818440Z
> ##[debug]Microsoft.VisualStudio.Services.Agent.ProcessExitCodeException:
> Exit code -529697949 returned from process: file name
> 'C:\VSTSAgent\externals\node\bin\node.exe', arguments
> '"C:\VSTSAgent\_work\_tasks\IISWebAppDeploymentOnMachineGroup_1b467810-6725-4b6d-accd-886174c09bba\0.0.39\deployiiswebapp.js"'.
> at
> Microsoft.VisualStudio.Services.Agent.ProcessInvoker.<ExecuteAsync>d__20.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---    at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)    at
> Microsoft.VisualStudio.Services.Agent.Worker.Handlers.DefaultStepHost.<ExecuteAsync>d__7.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---    at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)    at
> Microsoft.VisualStudio.Services.Agent.Worker.Handlers.NodeHandler.<RunAsync>d__6.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---    at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)    at
> Microsoft.VisualStudio.Services.Agent.Worker.TaskRunner.<RunAsync>d__24.MoveNext()
> --- End of stack trace from previous location where exception was thrown ---    at
> System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()    at
> System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task
> task)    at
> Microsoft.VisualStudio.Services.Agent.Worker.StepsRunner.<RunStepAsync>d__1.MoveNext()
> 2018-06-18T14:52:26.3822693Z ##[section]Finishing: Deploy Client

1 个答案:

答案 0 :(得分:0)

我已经解决了这个问题,看起来这是我的.STip文件在我的VSTS构建过程中创建的结果。我正在压缩整个应用程序文件夹,而不仅仅是我的Webpack输出文件夹。完成更改后,WebDeploy任务在VSTS中成功完成。