gpt4 book ai didi

javascript - 在 Azure 中部署 Angular 6

转载 作者:行者123 更新时间:2023-12-01 01:30:50 25 4
gpt4 key购买 nike

我正在尝试在 Azure 门户上部署示例应用程序,但遇到了一些困难。

首先我只是在测试,所以我只用 ng new poc-pwa-angular-v2 创建了一个 Angular 应用程序。之后我进入了 Bitbucket 存储库。

在 Azure 中,我创建了一个 Web 应用程序,并在部署选项中连接到了 bitbucket 并设置了我的主分支。

我尝试使用 kudu(deploy.cmd 和 .deployment)生成脚本,但在第一次部署时出现错误。

谁能给点建议吗?

看看我的日志。

Command: deploy.cmd
Handling node.js deployment.
Creating app_offline.htm
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'package.json'
Deleting app_offline.htm
Invalid start-up command "ng serve" in package.json. Please use the format "node <script relative path>".
Looking for app.js/server.js under site root.
Missing server.js/app.js files, web.config is not generated
The package.json file does not specify node.js engine version constraints.
The node.js application will run with the default node.js version 10.6.0.
Selected npm version 6.1.0

> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="d4a4bbb7f9a4a3b5f9b5bab3a1b8b5a6f9a2e694e4fae4fae4" rel="noreferrer noopener nofollow">[email protected]</a> postinstall D:\home\site\wwwroot
> npm run build


> <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="62120d014f1215034f030c05170e03104f145022524c524c52" rel="noreferrer noopener nofollow">[email protected]</a> build D:\home\site\wwwroot
> ng build

'ng' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ec9c838fc19c9b8dc18d828b99808d9ec19adeacdcc2dcc2dc" rel="noreferrer noopener nofollow">[email protected]</a> build: `ng build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="72021d115f0205135f131c15071e13005f044032425c425c42" rel="noreferrer noopener nofollow">[email protected]</a> build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_35_989Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="9bebf4f8b6ebecfab6faf5fceef7fae9b6eda9dbabb5abb5ab" rel="noreferrer noopener nofollow">[email protected]</a> postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="a4d4cbc789d4d3c589c5cac3d1c8c5d689d296e4948a948a94" rel="noreferrer noopener nofollow">[email protected]</a> postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
Failed exitCode=1, command="D:\Program Files (x86)\nodejs\10.6.0\node.exe" "D:\Program Files (x86)\npm\6.1.0\node_modules\npm\bin\npm-cli.js" install --production
npm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_36_053Z-debug.log
An error has occurred during web site deployment.
Invalid start-up command "ng serve" in package.json. Please use the format "node <script relative path>".\r\nMissing server.js/app.js files, web.config is not generated\r\n'ng' is not recognized as an internal or external command,\r\noperable program or batch file.\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="3d4d525e104d4a5c105c535a48515c4f104b0f7d0d130d130d" rel="noreferrer noopener nofollow">[email protected]</a> build: `ng build`\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="c5b5aaa6e8b5b2a4e8a4aba2b0a9a4b7e8b3f785f5ebf5ebf5" rel="noreferrer noopener nofollow">[email protected]</a> build script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_35_989Z-debug.log\r\nnpm ERR! code ELIFECYCLE\r\nnpm ERR! errno 1\r\nnpm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f1f000c421f180e420e01081a030e1d42195d2f5f415f415f" rel="noreferrer noopener nofollow">[email protected]</a> postinstall: `npm run build`\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="40302f236d3037216d212e27352c21326d367200706e706e70" rel="noreferrer noopener nofollow">[email protected]</a> postinstall script.\r\nnpm ERR! This is probably not a problem with npm. There is likely additional logging output above.\r\n\r\nnpm ERR! A complete log of this run can be found in:\r\nnpm ERR! D:\local\AppData\npm-cache\_logs\2018-11-13T22_16_36_053Z-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\78.11022.3613\bin\Scripts\starter.cmd deploy.cmd

最佳答案

问题是 Azure Angular cli 未安装。您需要在本地执行 ng build(或者作为构建和发布管道的一部分。您还可以使用 Azure DevOps 构建,其中您有 240 分钟的免费构建时间)并将其上传到 (只是选项):

  1. Azure 应用服务。
  2. 将其上传到 Blob 存储并使用 Azure 函数代理来提供您的文件。
  3. 如果您需要服务器端渲染,则需要将其作为 NodeJs 应用或 .net 应用的一部分上传

关于javascript - 在 Azure 中部署 Angular 6,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53290987/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com