Azure NodeJS Azure Devops 部署失败但 Visual Studio 部署工作完美
Azure NodeJS Azure Devops deployment failing but Visual Studio deploy works perfect
我们正在尝试将 NodeJS 应用程序部署到 Azure 应用程序服务 (Linux),如果我们从 Visual Studio 部署它,一切正常,网站呈现完美。
现在我们创建一个基本的 build/Release 管道并将 zip 文件(从构建创建)部署到 Azure 上的应用程序服务,然后如果我们尝试呈现该站点,它会抛出应用程序错误(以下是错误日志):
> 2020-04-15T20:27:47.222887443Z > externalservicestatus@0.0.0 start /home/site/wwwroot
2020-04-15T20:27:47.222895143Z > node ./bin/www
2020-04-15T20:27:47.222899943Z
2020-04-15T20:27:47.371119383Z internal/modules/cjs/loader.js:797
2020-04-15T20:27:47.371195483Z throw err;
2020-04-15T20:27:47.371942583Z ^
2020-04-15T20:27:47.371974683Z
2020-04-15T20:27:47.372042983Z ***Error: Cannot find module '/home/site/wwwroot/bin/www'
2020-04-15T20:27:47.372063083Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
2020-04-15T20:27:47.372103483Z at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-04-15T20:27:47.372136083Z at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
2020-04-15T20:27:47.372176983Z at internal/main/run_main_module.js:17:11 {
2020-04-15T20:27:47.372206183Z code: 'MODULE_NOT_FOUND',***
2020-04-15T20:27:47.372292683Z requireStack: []
2020-04-15T20:27:47.372316483Z }
2020-04-15T20:27:47.402670091Z npm ERR! code ELIFECYCLE
2020-04-15T20:27:47.409661993Z npm ERR! errno 1
2020-04-15T20:27:47.411500494Z npm ERR! externalservicestatus@0.0.0 start: `node ./bin/www`
2020-04-15T20:27:47.412151894Z npm ERR! Exit status 1
2020-04-15T20:27:47.412616894Z npm ERR!
2020-04-15T20:27:47.419115996Z npm ERR! Failed at the externalservicestatus@0.0.0 start script.
2020-04-15T20:27:47.419849596Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-15T20:27:47.432179799Z
2020-04-15T20:27:47.432704699Z npm ERR! A complete log of this run can be found in:
2020-04-15T20:27:47.433290000Z npm ERR! /root/.npm/_logs/2020-04-15T20_27_47_420Z-debug.log
2020-04-15 20:27:48.453 ERROR - Container testexternalapp2_0_6702db49 for site testexternalapp2 has exited, failing site start
2020-04-15 20:27:48.464 ERROR - Container testexternalapp2_0_6702db49 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
我发现,无论何时从 Visual Studio 部署“./bin/www”都会创建并部署到应用程序服务上,但无论何时从 Azure DevOps 发布管道部署“./bin/wwww" 丢失且不可用。有帮助吗?
这是我从 Visual Studio 部署时从日志流中看到的:
> /appsvctmp/volatile/logs/runtime/afbd672b48147e81a539c200a40b91607386719df21a7e51f842abbcd70c89db.log
2020-04-15T17:47:12.057871083Z: [INFO] echo "Done."
2020-04-15T17:47:12.057884183Z: [INFO] PATH="$PATH:/home/site/wwwroot" npm start
2020-04-15T17:47:13.285047383Z: [INFO] Found tar.gz based node_modules.
2020-04-15T17:47:13.295572890Z: [INFO] Removing existing modules directory from root...
2020-04-15T17:47:13.307481412Z: [INFO] Extracting modules...
2020-04-15T17:47:17.392564316Z: [INFO] Done.
2020-04-15T17:47:22.666823807Z: [INFO]
2020-04-15T17:47:22.666850507Z: [INFO] > externalservicestatus@0.0.0 start /home/site/wwwroot
2020-04-15T17:47:22.666855308Z: [INFO] > node ./bin/www
2020-04-15T17:47:22.666858408Z: [INFO]
从 Azure DevOps 部署时,这是我从日志中看到的内容:
2020-04-15T21:17:50.664112070Z npm ERR! errno 1
2020-04-15T21:17:50.664156869Z npm ERR! externalservicestatus@0.0.0 start: `node ./bin/www`
2020-04-15T21:17:50.664174469Z npm ERR! Exit status 1
2020-04-15T21:17:50.664206269Z npm ERR!
2020-04-15T21:17:50.664220669Z npm ERR! Failed at the externalservicestatus@0.0.0 start script.
2020-04-15T21:17:50.664251169Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-15T21:17:50.713658687Z
2020-04-15T21:17:50.713714987Z npm ERR! A complete log of this run can be found in:
2020-04-15T21:17:50.713837887Z npm ERR! /root/.npm/_logs/2020-04-15T21_17_50_672Z-debug.log
请下载你的神器,看看里面有什么。
由于管道中的路径配置错误,发布文件可能会出现问题。如果您缺少预期的 files/folders 在这种情况下 ./bin/www
您可能在管道中有一些错误并且在 Azure 上一切都很好。
在这种情况下,我还建议添加 bash: ls your-publish-directory
步骤来检查内容。
我们正在尝试将 NodeJS 应用程序部署到 Azure 应用程序服务 (Linux),如果我们从 Visual Studio 部署它,一切正常,网站呈现完美。 现在我们创建一个基本的 build/Release 管道并将 zip 文件(从构建创建)部署到 Azure 上的应用程序服务,然后如果我们尝试呈现该站点,它会抛出应用程序错误(以下是错误日志):
> 2020-04-15T20:27:47.222887443Z > externalservicestatus@0.0.0 start /home/site/wwwroot
2020-04-15T20:27:47.222895143Z > node ./bin/www
2020-04-15T20:27:47.222899943Z
2020-04-15T20:27:47.371119383Z internal/modules/cjs/loader.js:797
2020-04-15T20:27:47.371195483Z throw err;
2020-04-15T20:27:47.371942583Z ^
2020-04-15T20:27:47.371974683Z
2020-04-15T20:27:47.372042983Z ***Error: Cannot find module '/home/site/wwwroot/bin/www'
2020-04-15T20:27:47.372063083Z at Function.Module._resolveFilename (internal/modules/cjs/loader.js:794:15)
2020-04-15T20:27:47.372103483Z at Function.Module._load (internal/modules/cjs/loader.js:687:27)
2020-04-15T20:27:47.372136083Z at Function.Module.runMain (internal/modules/cjs/loader.js:1025:10)
2020-04-15T20:27:47.372176983Z at internal/main/run_main_module.js:17:11 {
2020-04-15T20:27:47.372206183Z code: 'MODULE_NOT_FOUND',***
2020-04-15T20:27:47.372292683Z requireStack: []
2020-04-15T20:27:47.372316483Z }
2020-04-15T20:27:47.402670091Z npm ERR! code ELIFECYCLE
2020-04-15T20:27:47.409661993Z npm ERR! errno 1
2020-04-15T20:27:47.411500494Z npm ERR! externalservicestatus@0.0.0 start: `node ./bin/www`
2020-04-15T20:27:47.412151894Z npm ERR! Exit status 1
2020-04-15T20:27:47.412616894Z npm ERR!
2020-04-15T20:27:47.419115996Z npm ERR! Failed at the externalservicestatus@0.0.0 start script.
2020-04-15T20:27:47.419849596Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-15T20:27:47.432179799Z
2020-04-15T20:27:47.432704699Z npm ERR! A complete log of this run can be found in:
2020-04-15T20:27:47.433290000Z npm ERR! /root/.npm/_logs/2020-04-15T20_27_47_420Z-debug.log
2020-04-15 20:27:48.453 ERROR - Container testexternalapp2_0_6702db49 for site testexternalapp2 has exited, failing site start
2020-04-15 20:27:48.464 ERROR - Container testexternalapp2_0_6702db49 didn't respond to HTTP pings on port: 8080, failing site start. See container logs for debugging.
我发现,无论何时从 Visual Studio 部署“./bin/www”都会创建并部署到应用程序服务上,但无论何时从 Azure DevOps 发布管道部署“./bin/wwww" 丢失且不可用。有帮助吗?
这是我从 Visual Studio 部署时从日志流中看到的:
> /appsvctmp/volatile/logs/runtime/afbd672b48147e81a539c200a40b91607386719df21a7e51f842abbcd70c89db.log
2020-04-15T17:47:12.057871083Z: [INFO] echo "Done."
2020-04-15T17:47:12.057884183Z: [INFO] PATH="$PATH:/home/site/wwwroot" npm start
2020-04-15T17:47:13.285047383Z: [INFO] Found tar.gz based node_modules.
2020-04-15T17:47:13.295572890Z: [INFO] Removing existing modules directory from root...
2020-04-15T17:47:13.307481412Z: [INFO] Extracting modules...
2020-04-15T17:47:17.392564316Z: [INFO] Done.
2020-04-15T17:47:22.666823807Z: [INFO]
2020-04-15T17:47:22.666850507Z: [INFO] > externalservicestatus@0.0.0 start /home/site/wwwroot
2020-04-15T17:47:22.666855308Z: [INFO] > node ./bin/www
2020-04-15T17:47:22.666858408Z: [INFO]
从 Azure DevOps 部署时,这是我从日志中看到的内容:
2020-04-15T21:17:50.664112070Z npm ERR! errno 1
2020-04-15T21:17:50.664156869Z npm ERR! externalservicestatus@0.0.0 start: `node ./bin/www`
2020-04-15T21:17:50.664174469Z npm ERR! Exit status 1
2020-04-15T21:17:50.664206269Z npm ERR!
2020-04-15T21:17:50.664220669Z npm ERR! Failed at the externalservicestatus@0.0.0 start script.
2020-04-15T21:17:50.664251169Z npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
2020-04-15T21:17:50.713658687Z
2020-04-15T21:17:50.713714987Z npm ERR! A complete log of this run can be found in:
2020-04-15T21:17:50.713837887Z npm ERR! /root/.npm/_logs/2020-04-15T21_17_50_672Z-debug.log
请下载你的神器,看看里面有什么。
由于管道中的路径配置错误,发布文件可能会出现问题。如果您缺少预期的 files/folders 在这种情况下 ./bin/www
您可能在管道中有一些错误并且在 Azure 上一切都很好。
在这种情况下,我还建议添加 bash: ls your-publish-directory
步骤来检查内容。