gpt4 book ai didi

node.js - 带有 Angular 5 应用程序的 Azure 部署选项未在持续集成中编译和构建

转载 作者:太空宇宙 更新时间:2023-11-03 22:43:20 25 4
gpt4 key购买 nike

我正在使用 Angular 5、bit-bucket、azure 应用服务,并且我已经设置了与 bit-bucket 和 Azure 部署选项的持续集成。

请查看以下详细信息

enter image description here enter image description here

enter image description here enter image description here

项目结构

enter image description here

我的package.json

{
"name": "vaquarkhana-poc-app",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build –prod ",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e",
"postinstall": "npm run build"
},
"engines": {
"node": ">=10.0.0",
"npm": ">=6.0.0"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.10",
"@angular/cdk": "^5.2.5",
"@angular/common": "^5.2.0",
"@angular/compiler": "^5.2.0",
"@angular/core": "^5.2.0",
"@angular/flex-layout": "^5.0.0-beta.14",
"@angular/forms": "^5.2.0",
"@angular/http": "^5.2.0",
"@angular/material": "^5.2.5",
"@angular/platform-browser": "^5.2.0",
"@angular/platform-browser-dynamic": "^5.2.0",
"@angular/router": "^5.2.0",
"core-js": "^2.4.1",
"hammerjs": "^2.0.8",
"rxjs": "^5.5.6",
"zone.js": "^0.8.19"
},
"devDependencies": {
"@angular/cli": "~1.7.4",
"@angular/compiler-cli": "^5.2.0",
"@angular/language-service": "^5.2.0",
"@types/jasmine": "~2.8.3",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"angular-ide": "^0.9.41",
"codelyzer": "^4.0.1",
"jasmine-core": "~2.8.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~2.0.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~4.1.0",
"tslint": "~5.9.1",
"typescript": "~2.5.3"
}
}

问题:我不想将任何构建依赖项文件夹添加到位桶中,例如

  • Node 模块
  • 距离

由于 Azure 在持续集成过程中构建 package.json,但是我的构建在部署过程中一直失败。

日志:

'ng' is not recognized as an internal or external command,
operable program or batch file.

npm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="33455242465241585b525d1e435c401e52434373031d031d03" rel="noreferrer noopener nofollow">[email protected]</a> build: `ng build –prod `
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="a2d4c3d3d7c3d0c9cac3cc8fd2cdd18fc3d2d2e2928c928c92" rel="noreferrer noopener nofollow">[email protected]</a> build script.
npm ERR! This is most likely a problem with the vaquarkhan-pos-app package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ng build –prod
npm ERR! You can get their info via:
npm ERR! npm owner ls vaquarkhan-pos-app
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
npm ERR! cwd D:\home\site\wwwroot
npm ERR! node -v v0.10.40
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
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="3a4c5b4b4f5b4851525b54174a5549175b4a4a7a0a140a140a" rel="noreferrer noopener nofollow">[email protected]</a> postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vaquar<a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8ee5e6efe0a3fee1fda3effefecebea0bea0be" 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:
npm ERR! D:\local\AppData\npm-cache\_logs\2018-07-21T05_08_50_688Z-debug.log
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
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\nnpm WARN lifecycle The node binary used for scripts is D:\Program Files (x86)\nodejs\0.10.28\node.exe but npm is using D:\Program Files (x86)\nodejs\10.6.0\node.exe itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.\r\nnpm WARN invalid config loglevel="notice"\r\n'ng' is not recognized as an internal or external command,\r\noperable program or batch file.\r\n\r\nnpm ERR! <a href="https://stackoverflow.com/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="8bfdeafafeeaf9e0e3eae5a6fbe4f8a6eafbfbcbbba5bba5bb" rel="noreferrer noopener nofollow">[email protected]</a> build: `ng build �prod `\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="106671616571627b78717e3d607f633d71606050203e203e20" rel="noreferrer noopener nofollow">[email protected]</a> build script.\r\nnpm ERR! This is most likely a problem with the vaquarkhan-pos-app package,\r\nnpm ERR! not with npm itself.\r\nnpm ERR! Tell the author that this fails on your system:\r\nnpm ERR! ng build �prod \r\nnpm ERR! You can get their info via:\r\nnpm ERR! npm owner ls vaquarkhan-pos-app\r\nnpm ERR! There is likely additional logging output above.\r\nnpm ERR! System Windows_NT 6.2.9200\r\nnpm ERR! command "node" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"\r\nnpm ERR! cwd D:\home\site\wwwroot\r\nnpm ERR! node -v v0.10.40\r\nnpm ERR! npm -v 1.4.28\r\nnpm ERR! code ELIFECYCLE\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="f58394848094879e9d949bd8859a86d8948585b5c5dbc5dbc5" 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="6a1c0b1b1f0b1801020b04471a0519470b1a1a2a5a445a445a" 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-07-21T05_08_50_688Z-debug.log\r\nD:\Program Files (x86)\SiteExtensions\Kudu\75.10629.3460\bin\Scripts\starter.cmd deploy.cmd

我想知道是否有人遇到同样的问题并解决了?

最佳答案

有两个问题需要解决

  1. 我明白了node -v v0.10.40在您的错误消息中,这是由应用程序设置中的无效 Node 版本引起的。设置WEBSITE_NODE_DEFAULT_VERSION10.6.0这是 Azure 上唯一符合您要求的版本。

  2. 使用 bitbucket 部署使您的代码由 Kudu 构建,这需要 devDependencies 中的 Angular 相关模块要安装在 Kudu 上,需要将它们复制到 dependencies .

enter image description here

关于node.js - 带有 Angular 5 应用程序的 Azure 部署选项未在持续集成中编译和构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51457828/

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