Angular 4软件包未在jenkins中安装,而安装在ssh上通过手动软件包安装进行,而package.json无法正常工作

时间:2019-01-01 20:35:04

标签: node.js jenkins

嗨,我遇到了问题。

我提到了package.json中所需的软件包。

 "dependencies": {
    "@angular/animations": "^4.2.6",
    "@angular/cdk": "^2.0.0-beta.8",
    "@angular/common": "^4.2.6",
    "@angular/compiler": "^4.2.6",
    "@angular/core": "^4.2.6",
    "@angular/flex-layout": "^2.0.0-beta.8",
    "@angular/forms": "^4.2.6",
    "@angular/http": "^4.2.6",
    "@angular/material": "^2.0.0-beta.8",
    "@angular/platform-browser": "^4.2.6",
    "@angular/platform-browser-dynamic": "^4.2.6",
    "@angular/router": "^4.2.6",
    "@ng-bootstrap/ng-bootstrap": "^1.0.0-beta.1",
    "@ngui/ngui": "^0.15.2",
    "@types/chart.js": "^2.7.34",
    "angular-calendar": "^0.16.0",
    "angular2-image-upload": "^0.6.1",
    "angular2-promise-buttons": "^1.0.13",
    "angular2-wizard": "^0.4.0",
    "angularx-flatpickr": "^2.0.1",
    "authorizenet": "^1.0.6",
    "chart.js": "^2.7.2",
    "core-js": "^2.4.1",
    "firebase": "^3.8.0",
    "flatpickr": "^4.5.1",
    "hammerjs": "^2.0.8",
    "jquery": "^3.2.1",
    "lodash": "^4.17.4",
    "ng2-bootstrap-grid": "^0.5.1",
    "ng2-charts": "^1.6.0",
    "ng2-input-autocomplete": "0.0.10",
    "ng2-inputmask": "^0.2.5",
    "ng2-toastr": "^4.1.2",
    "poper": "^0.1.1",
    "rxjs": "^5.1.0",
    "systemjs": "^0.21.5",
    "zone.js": "^0.8.4"
  },
  "devDependencies": {
    "@angular/cli": "1.0.3",
    "@angular/compiler-cli": "^4.0.0",
    "@types/jasmine": "2.5.38",
    "@types/lodash": "^4.14.65",
    "@types/node": "~6.0.60",
    "codelyzer": "~2.0.0",
    "jasmine-core": "~2.5.2",
    "jasmine-spec-reporter": "~3.2.0",
    "karma": "~1.4.1",
    "karma-chrome-launcher": "~2.1.1",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^0.2.0",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.5.3",
    "protractor": "~5.1.0",
    "ts-node": "~2.0.0",
    "tslint": "~4.5.0",
    "typescript": "~2.2.0",
    "webpack-bundle-analyzer": "^2.9.0"
  }
}

我的节点版本是6.11.1和npm 3.10.10 这在Windows计算机上可以,但是当我尝试在Ubuntu上安装它时, 我必须手动安装以下软件包:

npm install @angular/cli@1.0.3 
npm i @angular/router@4.2.6 
npm i @angular/platform-browser-dynamic@4.2.6 
npm i @angular/platform-browser@4.2.6 
npm i @angular/http@4.2.6 
npm i @angular/forms@4.2.6 
npm i @angular/core@4.2.6 
npm i @angular/compiler@4.2.6   
npm i @angular/common@4.2.6 
npm i @angular/compiler-cli@4.2.6
npm i @angular/animations@4.2.6 
npm i @angular/cdk@2.0.0-beta.8 
npm i @angular/material@2.0.0-beta.8 
npm i @ng-bootstrap/ng-bootstrap@1.0.0-beta.1

有效。我的问题是为什么package.json中没有遵循我的版本依赖性。有关角度安装的所有内容均安装在4.4.7上,这是不正确的。另外,我的詹金斯(Jenkins)无法安装这些依赖项。

我想使用詹金斯在构建中构建这些依赖项。

1 个答案:

答案 0 :(得分:0)

我为詹金斯创建了一个shell脚本

/var/lib/jenkins/testUI.sh

确保已授予chmod + x权限。

在Jenkins中,我通过给出上述位置来调用shell脚本,并且在此shell脚本中,提到了我要安装的所有软件包,它的工作原理就像一个魅力。

让我告诉你,我还使用以下命令创建了构建并将其传递给詹金斯执行shell

node --max-old-space-size = 4096 ./node_modules/@angular/cli/bin/ng build --prod --aot false --base-href“ / wow /”