Azure BitBucket 分发失败

Azure BitBucket distribution failure

我在 Microsoft Azure 平台上订阅了 Visual Studio MSDN,所以我决定将我的 Heroku 应用程序迁移到 Azure 云。
我得到了 3 个用 NodeJS 编写的应用程序和 1 个用 PHP 编写的应用程序。我正确部署了 2/3 的 nodeJS 应用程序,但我无法理解第三个应用程序有什么问题。每个应用程序都部署在不同的 BitBucket git 存储库中。 NodeJS 的存储库具有相同的配置:

从 Azure 的角度来看(使用新门户),我有一个名为 rankk 的 NodeJS 应用程序。我使用的服务计划是 D1。我可以正确地看到 3 "app and slots"。我为 rankk(应用程序名称)应用程序代码设置指向我的 bitBucket 存储库的持续集成。事实是分发总是失败(见下图):

我销毁了 Azure Web 应用程序并创建了一个新的相同情况。
我销毁了 BitBucket git 存储库,创建了一个新存储库,在 Azure 上创建了一个新的 Web 应用程序和 link 它们 - 同样的情况
据我所知,应用程序代码的 "distribution" 存在一些问题,但 azure 应用程序和 git 存储库我认为它们相互看到了。

如果我点击失败的详细信息(见上图,红旗),我只会看到这些东西(见下图):

我不明白:为什么右边有 4 个绿旗,左边有 1 个红旗?

问题的最后信息:应用程序和网络服务器日志都是空的。我认为这意味着没有分发成功 > 没有聚会(= 没有应用程序启动)。

--更新 感谢 Xiaomin Wu(下图),我找到了最后一个有用的日志文件。见下文:

 <step title="Incoming Request" date="2016-01-04T21:30:24.268" instance="fa3789" url="/deploy?scmType=BitbucketGit" method="POST" type="request" pid="3700,2,61" Connection="Keep-Alive" Content-Length="74" Expect="100-continue" Host="rankk.scm.azurewebsites.net" User-Agent="Azure-WebSites-Controller/50.0.8598.1705" x-ms-request-id="b6d3869b-b6e1-44a7-b288-3640647d4283" X-SITE-DEPLOYMENT-ID="rankk" >
    <step title="FetchHandler" date="2016-01-04T21:30:24.268" >
        <step title="Attempting to fetch target branch master" date="2016-01-04T21:30:24.287" />
        <!-- duration: 12ms -->
        <step title="Assuming git repository at D:\home\site\repository" date="2016-01-04T21:30:24.332" />
        <!-- duration: 0ms -->
        <step title="Performing fetch based deployment" date="2016-01-04T21:30:24.441" >
            <step title="Creating temporary deployment" date="2016-01-04T21:30:24.441" />
            <!-- duration: 31ms -->
            <step title="LibGit2SharpRepository Fetch" date="2016-01-04T21:30:24.693" />
            <!-- duration: 0ms -->
            <step title="Warning" date="2016-01-04T21:30:24.693" type="warning" text="LibGit2SharpRepository fallback to git.exe due to Unsupported URL protocol" />
            <!-- duration: 16ms -->
            <step title="Executing external process" date="2016-01-04T21:30:24.708" type="process" path="git.exe" arguments="remote add -t master external &quot;git@bitbucket.org:sturm20/core.git&quot;" >
                <step title="Process dump" date="2016-01-04T21:30:24.740" exitCode="128" type="processOutput" />
                <!-- duration: 16ms -->
            </step>
            <!-- duration: 47ms -->
            <step title="Executing external process" date="2016-01-04T21:30:24.756" type="process" path="git.exe" arguments="remote rm external" />
            <!-- duration: 143ms -->
            <step title="Executing external process" date="2016-01-04T21:30:24.915" type="process" path="git.exe" arguments="remote add -t master external &quot;git@bitbucket.org:sturm20/core.git&quot;" />
            <!-- duration: 641ms -->
            <step title="Executing external process" date="2016-01-04T21:30:25.555" type="process" path="git.exe" arguments="branch" />
            <!-- duration: 47ms -->
            <step title="Executing external process" date="2016-01-04T21:30:25.602" type="process" path="git.exe" arguments="fetch external --progress" />
            <!-- duration: 4937ms -->
            <step title="Executing external process" date="2016-01-04T21:30:30.553" type="process" path="git.exe" arguments="update-ref refs/heads/master external/master" />
            <!-- duration: 109ms -->
            <step title="Executing external process" date="2016-01-04T21:30:30.678" type="process" path="git.exe" arguments="checkout master --force" />
            <!-- duration: 1554ms -->
            <step title="Executing external process" date="2016-01-04T21:30:32.231" type="process" path="git.exe" arguments="remote rm external" />
            <!-- duration: 94ms -->
            <step title="DeploymentManager.Deploy(id)" date="2016-01-04T21:30:32.341" >
                <step title="Collecting changeset information" date="2016-01-04T21:30:32.356" />
                <!-- duration: 31ms -->
                <step title="Updating submodules" date="2016-01-04T21:30:32.403" />
                <!-- duration: 47ms -->
                <step title="Determining deployment builder" date="2016-01-04T21:30:32.513" >
                    <step title="Builder is NodeSiteBuilder" date="2016-01-04T21:30:34.617" />
                    <!-- duration: 0ms -->
                </step>
                <!-- duration: 2104ms -->
                <step title="Copying SSH keys" date="2016-01-04T21:30:34.648" />
                <!-- duration: 17ms -->
                <step title="Building" date="2016-01-04T21:30:34.665" >
                    <step title="Generating deployment script" date="2016-01-04T21:30:34.713" >
                        <step title="Using cached version of the deployment script for command: -y --no-dot-deployment -r &quot;D:\home\site\repository&quot; -o &quot;D:\home\site\deployments\tools&quot; --node --sitePath &quot;D:\home\site\repository&quot;" date="2016-01-04T21:30:34.744" />
                        <!-- duration: 0ms -->
                    </step>
                    <!-- duration: 32ms -->
                    <step title="Executing external process" date="2016-01-04T21:30:35.304" type="process" path="starter.cmd" arguments="&quot;D:\home\site\deployments\tools\deploy.cmd&quot;" >
                        <step title="Process dump" date="2016-01-04T21:31:05.444" exitCode="255" type="processOutput" />
                        <!-- duration: 16ms -->
                    </step>
                    <!-- duration: 30156ms -->
                    <step title="Error occurred" date="2016-01-04T21:31:05.459" type="error" text="npm WARN package.json core@0.0.1 No repository field.
npm WARN package.json core@0.0.1 license should be a valid SPDX license expression
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: 404 status code downloading 32-bit node.lib
gyp ERR! stack     at Request.&lt;anonymous&gt; (c:\Program Files (x86)\npm.11.2\node_modules\npm\node_modules\node-gyp\lib\install.js:377:20)
gyp ERR! stack     at emitOne (events.js:82:20)
gyp ERR! stack     at Request.emit (events.js:169:7)
gyp ERR! stack     at Request.onRequestResponse (c:\Program Files (x86)\npm.11.2\node_modules\npm\node_modules\request\request.js:1142:10)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at ClientRequest.emit (events.js:169:7)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient (_http_client.js:415:21)
gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
gyp ERR! stack     at Socket.socketOnData (_http_client.js:305:20)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command &quot;D:\Program Files (x86)\nodejs\4.2.3\node.exe&quot; &quot;c:\Program Files (x86)\npm\2.11.2\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js&quot; &quot;rebuild&quot;
gyp ERR! cwd D:\home\site\wwwroot\node_modules\node-expat
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 

npm ERR! Windows_NT 6.2.9200
npm ERR! argv &quot;D:\Program Files (x86)\nodejs\0.12.6\node.exe&quot; &quot;D:\Program Files (x86)\npm\2.11.2\node_modules\npm\bin\npm-cli.js&quot; &quot;install&quot; &quot;--production&quot;
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! node-expat@2.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-expat@2.3.9 install script &apos;node-gyp rebuild&apos;.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log
C:\Program Files (x86)\SiteExtensions\Kudu.41223.1987\bin\scripts\starter.cmd &quot;D:\home\site\deployments\tools\deploy.cmd&quot;" stackTrace="   at Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer tracer, Func`2 onWriteOutput, Func`2 onWriteError, Encoding encoding, String arguments, Object[] args)
   at Kudu.Core.Infrastructure.Executable.ExecuteWithProgressWriter(ILogger logger, ITracer tracer, String arguments, Object[] args)
   at Kudu.Core.Deployment.Generator.ExternalCommandBuilder.RunCommand(DeploymentContext context, String command)" />
                    <!-- duration: 16ms -->
                </step>
                <!-- duration: 30952ms -->
                <step title="Error occurred" date="2016-01-04T21:31:05.617" type="error" text="npm WARN package.json core@0.0.1 No repository field.
npm WARN package.json core@0.0.1 license should be a valid SPDX license expression
gyp WARN install got an error, rolling back install
gyp ERR! configure error 
gyp ERR! stack Error: 404 status code downloading 32-bit node.lib
gyp ERR! stack     at Request.&lt;anonymous&gt; (c:\Program Files (x86)\npm.11.2\node_modules\npm\node_modules\node-gyp\lib\install.js:377:20)
gyp ERR! stack     at emitOne (events.js:82:20)
gyp ERR! stack     at Request.emit (events.js:169:7)
gyp ERR! stack     at Request.onRequestResponse (c:\Program Files (x86)\npm.11.2\node_modules\npm\node_modules\request\request.js:1142:10)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! stack     at ClientRequest.emit (events.js:169:7)
gyp ERR! stack     at HTTPParser.parserOnIncomingClient (_http_client.js:415:21)
gyp ERR! stack     at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
gyp ERR! stack     at Socket.socketOnData (_http_client.js:305:20)
gyp ERR! stack     at emitOne (events.js:77:13)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command &quot;D:\Program Files (x86)\nodejs\4.2.3\node.exe&quot; &quot;c:\Program Files (x86)\npm\2.11.2\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js&quot; &quot;rebuild&quot;
gyp ERR! cwd D:\home\site\wwwroot\node_modules\node-expat
gyp ERR! node -v v4.2.3
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 

npm ERR! Windows_NT 6.2.9200
npm ERR! argv &quot;D:\Program Files (x86)\nodejs\0.12.6\node.exe&quot; &quot;D:\Program Files (x86)\npm\2.11.2\node_modules\npm\bin\npm-cli.js&quot; &quot;install&quot; &quot;--production&quot;
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! node-expat@2.3.9 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-expat@2.3.9 install script &apos;node-gyp rebuild&apos;.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log
C:\Program Files (x86)\SiteExtensions\Kudu.41223.1987\bin\scripts\starter.cmd &quot;D:\home\site\deployments\tools\deploy.cmd&quot;" stackTrace="   at Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer tracer, Func`2 onWriteOutput, Func`2 onWriteError, Encoding encoding, String arguments, Object[] args)
   at Kudu.Core.Infrastructure.Executable.ExecuteWithProgressWriter(ILogger logger, ITracer tracer, String arguments, Object[] args)
   at Kudu.Core.Deployment.Generator.ExternalCommandBuilder.RunCommand(DeploymentContext context, String command)
   at Kudu.Core.Deployment.Generator.GeneratorSiteBuilder.Build(DeploymentContext context)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Kudu.Core.Deployment.DeploymentManager.&lt;Build&gt;d__29.MoveNext()" />
                <!-- duration: 0ms -->
            </step>
            <!-- duration: 33292ms -->
            <step title="Cleaning up temp files" date="2016-01-04T21:31:05.633" />
            <!-- duration: 16ms -->
            <step title="WebHooksManager.PublishEventAsync: PostDeployment" date="2016-01-04T21:31:05.664" />
            <!-- duration: 16ms -->
        </step>
        <!-- duration: 41254ms -->
    </step>`enter code here`
    <!-- duration: 41443ms -->
    <step title="Outgoing response" date="2016-01-04T21:31:05.711" type="response" statusCode="200" statusText="OK" Server="Microsoft-IIS/8.0" Cache-Control="private" X-AspNet-Version="4.0.30319" />
    <!-- duration: 0ms -->
</step>
<!-- duration: 41459ms -->

现在:尽管在我的机器上成功构建,为什么 node-gyp 无法在云上构建?我应该问 node-expat 的所有者,但他似乎无法访问(见下面的截图):

--第二次更新 正如下面的答案所暗示的,我的 Azure 应用程序上的节点版本 运行 是 0.6.x。在我的 package.json 上有 0.12.6。 0.12.6 在 D:\Program Files (x86)\node > ls 上可用,我将其设置在应用程序变量上。问题解决了,但是变了。现在我得到了:

<step title="Error occurred" date="2016-01-09T23:39:01.588" type="error" text="npm WARN package.json core@0.0.1 No description
npm WARN package.json core@0.0.1 No repository field.
npm WARN package.json core@0.0.1 No README data
npm WARN package.json core@0.0.1 No license field.
gyp ERR! build error 
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\Program Files (x86)\npm.11.2\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command &quot;node&quot; &quot;c:\Program Files (x86)\npm\2.11.2\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js&quot; &quot;rebuild&quot;
gyp ERR! cwd D:\home\site\wwwroot\node_modules\node-expat
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 

npm ERR! Windows_NT 6.2.9200
npm ERR! argv &quot;D:\Program Files (x86)\nodejs\0.12.6\node.exe&quot; &quot;D:\Program Files (x86)\npm\2.11.2\node_modules\npm\bin\npm-cli.js&quot; &quot;install&quot; &quot;--production&quot;
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! node-expat@2.3.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-expat@2.3.12 install script &apos;node-gyp rebuild&apos;.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log
C:\Program Files (x86)\SiteExtensions\Kudu.50108.2013\bin\scripts\starter.cmd &quot;D:\home\site\deployments\tools\deploy.cmd&quot;" stackTrace="   at Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer tracer, Func`2 onWriteOutput, Func`2 onWriteError, Encoding encoding, String arguments, Object[] args)
   at Kudu.Core.Infrastructure.Executable.ExecuteWithProgressWriter(ILogger logger, ITracer tracer, String arguments, Object[] args)
   at Kudu.Core.Deployment.Generator.ExternalCommandBuilder.RunCommand(DeploymentContext context, String command, String message)" />
                    <!-- duration: 0ms -->
                </step>
                <!-- duration: 19761ms -->
                <step title="Error occurred" date="2016-01-09T23:39:01.681" type="error" text="npm WARN package.json core@0.0.1 No description
npm WARN package.json core@0.0.1 No repository field.
npm WARN package.json core@0.0.1 No README data
npm WARN package.json core@0.0.1 No license field.
gyp ERR! build error 
gyp ERR! stack Error: `msbuild` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (c:\Program Files (x86)\npm.11.2\node_modules\npm\node_modules\node-gyp\lib\build.js:269:23)
gyp ERR! stack     at ChildProcess.emit (events.js:110:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:1074:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command &quot;node&quot; &quot;c:\Program Files (x86)\npm\2.11.2\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js&quot; &quot;rebuild&quot;
gyp ERR! cwd D:\home\site\wwwroot\node_modules\node-expat
gyp ERR! node -v v0.12.6
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok 

npm ERR! Windows_NT 6.2.9200
npm ERR! argv &quot;D:\Program Files (x86)\nodejs\0.12.6\node.exe&quot; &quot;D:\Program Files (x86)\npm\2.11.2\node_modules\npm\bin\npm-cli.js&quot; &quot;install&quot; &quot;--production&quot;
npm ERR! node v0.12.6
npm ERR! npm  v2.11.2
npm ERR! code ELIFECYCLE
npm ERR! node-expat@2.3.12 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-expat@2.3.12 install script &apos;node-gyp rebuild&apos;.
npm ERR! This is most likely a problem with the node-expat package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-expat
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\home\site\wwwroot\npm-debug.log
C:\Program Files (x86)\SiteExtensions\Kudu.50108.2013\bin\scripts\starter.cmd &quot;D:\home\site\deployments\tools\deploy.cmd&quot;" stackTrace="   at Kudu.Core.Infrastructure.Executable.ExecuteInternal(ITracer tracer, Func`2 onWriteOutput, Func`2 onWriteError, Encoding encoding, String arguments, Object[] args)
   at Kudu.Core.Infrastructure.Executable.ExecuteWithProgressWriter(ILogger logger, ITracer tracer, String arguments, Object[] args)
   at Kudu.Core.Deployment.Generator.ExternalCommandBuilder.RunCommand(DeploymentContext context, String command, String message)
   at Kudu.Core.Deployment.Generator.GeneratorSiteBuilder.Build(DeploymentContext context)
--- End of stack trace from previous location where exception was thrown ---
   at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
   at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
   at Kudu.Core.Deployment.DeploymentManager.&lt;Build&gt;d__29.MoveNext()" />
                <!-- duration: 0ms -->
            </step>

@Francesco,我在 Azure 新门户上设置与 BitBucket 的持续集成时遇到了同样的问题。但是我发现我可以在 Azure 旧门户上的 Azure WebApps 标签页的 DASHBOARD 标签页的右侧栏成功地完成它。

所以我建议您可以尝试在 Azure 旧门户上再次使用 BitBucket set up deployment from source control,请参见下文。

我认为根本原因是 Azure App Service 环境具有更高版本的节点,而 Francesco 具有非常旧的节点版本。

转到 https://{your site name}.scm.azurewebsites.net/DebugConsole 并导航到 D:\Program Files (x86)\nodejs 查看所有可用的 nodejs。并通过 npm versionnode -v

检查默认的 nodejs 版本

对于select特定的nodejs版本,通过应用程序设置定义环境变量

导航到您的站点 --> 所有设置 --> 应用程序设置 --> 应用程序设置

键:WEBSITE_NODE_DEFAULT_VERSION,值:{version}