Наше задание Jenkins не выполняется с момента обновления до Angular 9. Все работает из командной строки, когда вы вошли на сервер сборки как строитель. Это также работает на других устройствах в командной строке. Но когда выполняется задание Jenkins, скрипт ng build --prod
завершается с ошибкой
Сообщение об ошибке:
[33mWarning:[0m Entry point 'devextreme-angular/ui/vector-map' contains deep imports into 'C:/Users/builduser/.jenkins/workspace/my_project-Angular9/node_modules/devextreme/viz/vector_map', 'C:/Users/builduser/.jenkins/workspace/my_project-Angular9/node_modules/devextreme/bundles/dx.all'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
npm info lifecycle my_project@1.0.30~build: Failed to exec build script
npm ERR! code ELIFECYCLE
npm ERR! errno 134
npm ERR! my_project@1.0.30 build: `ng build --prod`
npm ERR! Exit status 134
npm ERR!
npm ERR! Failed at the my_project@1.0.30 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm timing npm Completed in 161871ms
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\builduser\AppData\Roaming\npm-cache\_logs\2020-04-14T15_05_03_975Z-debug.log
Предупреждения Devextreme в начале также появляются в успешных сборках на наших локальных компьютерах, поэтому я не уверен, действительно ли это проблема или их можно игнорировать.
NodeJS версия 12.16.1 и NPM версия 6.13.4 на всех машинах.
Полный журнал, упомянутый выше:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Users\\builduser\\.jenkins\\tools\\jenkins.plugins.nodejs.tools.NodeJSInstallation\\node12\\node.exe',
1 verbose cli 'C:\\Users\\builduser\\.jenkins\\tools\\jenkins.plugins.nodejs.tools.NodeJSInstallation\\node12\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.16.1
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle my_project@1.0.30~prebuild: my_project@1.0.30
6 info lifecycle my_project@1.0.30~build: my_project@1.0.30
7 verbose lifecycle my_project@1.0.30~build: unsafe-perm in lifecycle true
8 verbose lifecycle my_project@1.0.30~build: PATH: C:\Users\builduser\.jenkins\tools\jenkins.plugins.nodejs.tools.NodeJSInstallation\node12\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\builduser\.jenkins\workspace\my_project-Angular9\node_modules\.bin;C:\Users\builduser\.jenkins\tools\jenkins.plugins.nodejs.tools.NodeJSInstallation\node12;C:\Users\builduser\.jenkins\tools\jenkins.plugins.nodejs.tools.NodeJSInstallation\node12;C:\Bitnami\rubystack-2.4.5-7\ImageMagick-7.0.8-Q16;C:\Program Files (x86)\Windows Resource Kits\Tools\;C:\Program Files (x86)\PHP\v5.4;C:\Windows\system32\inetsrv;C:\Program Files (x86)\PHP\v7.0;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Microsoft SQL Server\110\Tools\Binn\;C:\Program Files (x86)\Microsoft SDKs\TypeScript\1.0\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;C:\ProgramData\chocolatey\bin;C:\Program Files\Java\jdk1.8.0_162\bin;C:\Users\alisakarolina.becker\AppData\Local\Microsoft\WindowsApps;C:\Python27;C:\Users\builduser\gradle\wrapper\dists\gradle-4.5-bin\36tjdrrafkua0yehaomoqzk6f\gradle-4.5\bin;C:\Program Files\Git\cmd;C:\Program Files\dotnet\;C:\Program Files\Microsoft Windows Performance Toolkit\;C:\Qt\Tools\QtCreator\bin;C:\Program Files\Microsoft\Web Platform Installer\;C:\Program Files (x86)\Gpg4win\..\GnuPG\bin;C:\Program Files\doxygen\bin;C:\Maven\apache-maven-3.6.1\bin;C:\Program Files\PostgreSQL\12\bin;C:\Tools\sonar-scanner-4.2.0.1873-windows\bin;C:\Program Files\nodejs\;C:\Users\builduser\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\builduser\Documents\gradle\gradle-4.5\bin;C:\Tools\CppDepend;C:\Program Files\Cppcheck;C:\Tools\Process Explorer
9 verbose lifecycle my_project@1.0.30~build: CWD: C:\Users\builduser\.jenkins\workspace\my_project-Angular9
10 silly lifecycle my_project@1.0.30~build: Args: [ '/d /s /c', 'ng build --prod' ]
11 silly lifecycle my_project@1.0.30~build: Returned: code: 134 signal: null
12 info lifecycle my_project@1.0.30~build: Failed to exec build script
13 verbose stack Error: my_project@1.0.30 build: `ng build --prod`
13 verbose stack Exit status 134
13 verbose stack at EventEmitter.<anonymous> (C:\Users\builduser\.jenkins\tools\jenkins.plugins.nodejs.tools.NodeJSInstallation\node12\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:311:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\builduser\.jenkins\tools\jenkins.plugins.nodejs.tools.NodeJSInstallation\node12\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:311:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid my_project@1.0.30
15 verbose cwd C:\Users\builduser\.jenkins\workspace\my_project-Angular9
16 verbose Windows_NT 10.0.14393
17 verbose argv "C:\\Users\\builduser\\.jenkins\\tools\\jenkins.plugins.nodejs.tools.NodeJSInstallation\\node12\\node.exe" "C:\\Users\\builduser\\.jenkins\\tools\\jenkins.plugins.nodejs.tools.NodeJSInstallation\\node12\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v12.16.1
19 verbose npm v6.13.4
20 error code ELIFECYCLE
21 error errno 134
22 error my_project@1.0.30 build: `ng build --prod`
22 error Exit status 134
23 error Failed at the my_project@1.0.30 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 134, true ]
Файл Jenkinsfile:
pipeline {
agent any
tools {nodejs "node12"}
stages {
stage('install dependencies') {
steps {
bat 'npm install --no-save'
}
}
stage('build version') {
steps {
bat "npm run build"
}
}
}
Пакет. json:
{
"name": "my_project",
"version": "1.0.30",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build --prod"
},
"dependencies": {
"@angular/animations": "^9.1.1",
"@angular/cdk": "^9.2.0",
"@angular/common": "^9.1.1",
"@angular/compiler": "^9.1.1",
"@angular/core": "^9.1.1",
"@angular/elements": "^9.1.1",
"@angular/forms": "^9.1.1",
"@angular/material": "^9.2.0",
"@angular/platform-browser": "^9.1.1",
"@angular/platform-browser-dynamic": "^9.1.1",
"@angular/router": "^9.1.1",
"@angular/upgrade": "^9.1.1",
"compass-mixins": "^0.12.10",
"core-js": "^3.6.4",
"dateformat": "^3.0.2",
"devextreme": "^19.2.7",
"devextreme-angular": "^19.2.7",
"devextreme-intl": "^19.1.8",
"in-view": "^0.6.1",
"jquery": "^3.4.1",
"lodash": "^4.17.15",
"muuri": "0.8.0",
"ng2-nouislider": "^1.8.2",
"nouislider": "^14.1.1",
"reflect-metadata": "^0.1.13",
"rxjs": "6.5.5",
"tslib": "^1.11.1",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "~0.901.1",
"@angular/cli": "^9.1.1",
"@angular/compiler-cli": "9.1.1",
"@angular/language-service": "^9.1.1",
"@angular/platform-server": "9.1.1",
"@types/dateformat": "^3.0.1",
"@types/jasmine": "^3.5.9",
"@types/jasminewd2": "~2.0.6",
"@types/jquery": "^3.3.33",
"@types/node": "^13.9.1",
"@types/selenium-webdriver": "^4.0.9",
"clang-format": "^1.0.32",
"css-loader": "^3.2.0",
"cypress": "^3.8.3",
"del": "^5.1.0",
"extract-text-webpack-plugin": "^4.0.0-beta.0",
"file-loader": "^5.1.0",
"fs-extra": "^8.1.0",
"html-loader": "^0.5.1",
"html-webpack-plugin": "^3.2.0",
"jasmine-core": "^3.4.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "~4.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "^2.0.1",
"karma-coverage-istanbul-reporter": "^2.1.0",
"karma-jasmine": "^3.1.1",
"karma-jasmine-html-reporter": "^1.4.2",
"karma-sourcemap-loader": "^0.3.7",
"karma-typescript": "^4.1.1",
"lodash.throttle": "^4.1.1",
"ng-annotate-webpack-plugin": "^0.3.0",
"ng-focus-if": "^1.0.7",
"node-sass": "^4.12.0",
"node-sass-json-importer": "^4.1.2",
"pre-commit": "^1.2.2",
"properties-loader": "0.0.1",
"protractor": "^5.4.2",
"sass-loader": "^8.0.2",
"script-loader": "^0.7.2",
"source-map-loader": "^0.2.1",
"style-loader": "^0.21.0",
"ts-loader": "^6.2.1",
"ts-node": "^8.0.0",
"tslint": "^6.1.0",
"typescript": "~3.7.5",
"watch": "^1.0.2",
"webpack-bundle-analyzer": "^3.6.1"
}
}
Скрипт "build" работает, если параметр "--prod" удален
angular. json:
{
"$schema": "./node_modules/@angular/cli/lib/config/schema.json",
"version": 1,
"newProjectRoot": "projects",
"projects": {
"my_project": {
"root": "",
"sourceRoot": "src",
"projectType": "application",
"prefix": "rc",
"schematics": {
"@schematics/angular:component": {
"style": "scss"
}
},
"architect": {
"build": {
"builder": "@angular-devkit/build-angular:browser",
"options": {
"aot": true,
"outputPath": "dist/my_project",
"index": "src/index.html",
"main": "src/main.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.app.json",
"assets": [
"src/favicon.ico",
"src/assets"
],
"styles": [],
"scripts": []
},
"configurations": {
"production": {
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.prod.ts"
}
],
"optimization": true,
"outputHashing": "all",
"sourceMap": false,
"extractCss": true,
"namedChunks": false,
"aot": true,
"extractLicenses": true,
"vendorChunk": false,
"buildOptimizer": true,
"budgets": [
{
"type": "initial",
"maximumWarning": "2mb",
"maximumError": "8mb"
},
{
"type": "anyComponentStyle",
"maximumWarning": "6kb"
}
]
}
}
},
"serve": {
"builder": "@angular-devkit/build-angular:dev-server",
"options": {
"browserTarget": "my_project:build",
"aot": true
},
"configurations": {
"production": {
"browserTarget": "my_project:build:production"
}
}
},
"extract-i18n": {
"builder": "@angular-devkit/build-angular:extract-i18n",
"options": {
"browserTarget": "my_project:build"
}
},
"test": {
"builder": "@angular-devkit/build-angular:karma",
"options": {
"main": "src/test.ts",
"polyfills": "src/polyfills.ts",
"tsConfig": "src/tsconfig.spec.json",
"karmaConfig": "src/karma.conf.ts",
"styles": [
"src/styles.scss"
],
"scripts": [],
"assets": [
"src/favicon.ico",
"src/assets"
]
}
},
"lint": {
"builder": "@angular-devkit/build-angular:tslint",
"options": {
"tsConfig": [
"src/tsconfig.app.json",
"src/tsconfig.spec.json"
],
"exclude": [
"**/node_modules/**"
]
}
}
}
},
},
"defaultProject": "my_project"
}
Кто-нибудь имеет представление о причине этой ошибки?