简体   繁体   English

Gitlab ci 未安装所有依赖项(角度应用程序)

[英]Gitlab ci doesn't install all dependencies (angular app)

I'm trying to build and deploy angular application using gitlab-ci here is my config我正在尝试使用 gitlab-ci 构建和部署 angular 应用程序这是我的配置

stages:
  - build

build:
  stage: build
  image: node:12.21.0
  only:
    - master
  script:
    - npm install -g @angular/cli@11.2.6
    - npm install
    - npm run build:i18n

and here are my dependencies from package.json这是我对package.json的依赖

"dependencies": {
  "@agm/core": "^1.1.0",
  "@angular/animations": "~11.2.5",
  "@angular/common": "~11.2.5",
  "@angular/compiler": "~11.2.5",
  "@angular/core": "~11.2.5",
  "@angular/fire": "^6.1.4",
  "@angular/forms": "~11.2.5",
  "@angular/localize": "^11.2.5",
  "@angular/platform-browser": "^11.2.5",
  "@angular/platform-browser-dynamic": "~11.2.5",
  "@angular/router": "~11.2.5",
  "@asymmetrik/ngx-leaflet": "^8.1.0",
  "@ng-bootstrap/ng-bootstrap": "^6.2.0",
  "@popperjs/core": "^2.9.1",
  "@swimlane/ngx-datatable": "^17.1.0",
  "@types/jquery": "^3.5.5",
  "angular-calendar": "^0.28.22",
  "angular2-text-mask": "^9.0.0",
  "angularx-flatpickr": "^6.5.2",
  "apexcharts": "^3.25.0",
  "bootstrap": "^4.6.0",
  "bourbon": "^4.3.4",
  "chart.js": "^2.9.4",
  "date-fns": "^1.30.1",
  "easy-pie-chart": "^2.1.7",
  "file-saver": "^2.0.5",
  "firebase": "^7.0 || ^8.0",
  "flatpickr": "^4.6.9",
  "jquery": "^3.6.0",
  "jquery-sparkline": "^2.4.0",
  "leaflet": "^1.7.1",
  "lodash": "^4.17.21",
  "ng-apexcharts": "^1.5.8",
  "ng2-charts": "^2.4.2",
  "ngx-chips": "^2.2.2",
  "ngx-perfect-scrollbar": "^9.0.0",
  "ngx-toastr": "^12.1.0",
  "ngx-ui-switch": "^8.3.0",
  "peity": "^3.3.0",
  "popper.js": "^1.16.1",
  "quill": "^1.3.7",
  "rxjs": "^6.6.6",
  "sweetalert2": "^7.33.1",
  "text-mask-addons": "^3.8.0",
  "tslib": "^2.1.0",
  "zone.js": "~0.10.3"
},

npm run build:i18n is set to run ng build --prod --localize command. npm run build:i18n设置为运行ng build --prod --localize命令。

Problem:问题:
npm run build:i18n fails every time with this error: npm run build:i18n每次都失败并出现以下错误:

Error: src/app/merchandises/merchandises.service.ts:6:24 - error TS2307: Cannot find module 'file-saver/src/fileSaver' or its corresponding type declarations.
6 import { saveAs } from 'file-saver/src/fileSaver';
                         ~~~~~~~~~~~~~~~~~~~~~~~~~~
Error: ./src/app/merchandises/merchandises.service.ts

But on my pc where I use same version of node, npm and nagular/cli it works just fine and file-saver package is clearly in dependencies.但是在我使用相同版本节点的电脑上,npm 和 nagular/cli 它工作得很好, file-saver package 显然是依赖关系。 I'm not caching anything at this point (I did but I have removed it while testing).我现在没有缓存任何东西(我做了,但我在测试时删除了它)。

Any ideas?有任何想法吗?

Try using a different image with Angular CLI:尝试使用 Angular CLI 使用不同的图像:

build_front_end:
  image: trion/ng-cli

https://hub.docker.com/r/trion/ng-cli/ https://hub.docker.com/r/trion/ng-cli/

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM