作者:书友32976730 | 来源:互联网 | 2022-12-09 22:48
我正在使用Angular 5,bit-bucket,azure app服务,我已经设置了与bit-bucket和Azure部署选项的持续集成.
请找到以下详细信息
项目结构
我的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_modules
DIST
由于Azure在持续集成期间构建了package.json,但是我的构建在部署期间始终失败.
日志:
'ng' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! vaquarkhan-pos-app@0.0.0 build: `ng build –prod `
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vaquarkhan-pos-app@0.0.0 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! vaquarkhan-pos-app@0.0.0 postinstall: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vaquarkhan-pos-app@0.0.0 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 ".\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! vaquarkhan-pos-app@0.0.0 build: `ng build ?prod `\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the vaquarkhan-pos-app@0.0.0 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! vaquarkhan-pos-app@0.0.0 postinstall: `npm run build`\r\nnpm ERR! Exit status 1\r\nnpm ERR! \r\nnpm ERR! Failed at the vaquarkhan-pos-app@0.0.0 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> Jerry Liu..:
拖点修复
我node -v v0.10.40
在您的错误消息中看到,这是由应用程序设置中的无效节点版本引起的.设置WEBSITE_NODE_DEFAULT_VERSION
为10.6.0
Azure上唯一符合您要求的版本.
使用bitbucket进行部署使您的代码由Kudu构建,这需要将您的角度相关模块devDependencies
安装在Kudu上,需要将它们复制到dependencies
.