[英]Error while Running CI Pipeline on Gitlab
我正在嘗試在 gitlab 上部署我的 angular 7 應用程序,我的 .gitlabci.yml 內容如下它在管道上的提供,並且兩個工作都失敗了。 我想在 CI 上運行測試
image: node:latest
cache:
key: ${CI_COMMIT_REF_SLUG}
paths:
- node_modules/
before_script:
- apt-get update && apt-get install -y unzip fontconfig locales gconf-service libasound2 libatk1.0-0 libc6 libcairo2 libcups2 libdbus-1-3 libexpat1 libfontconfig1 libgcc1 libgconf-2-4 libgdk-pixbuf2.0-0 libglib2.0-0 libgtk-3-0 libnspr4 libpango-1.0-0 libpangocairo-1.0-0 libstdc++6 libx11-6 libx11-xcb1 libxcb1 libxcomposite1 libxcursor1 libxdamage1 libxext6 libxfixes3 libxi6 libxrandr2 libxrender1 libxss1 libxtst6 ca-certificates fonts-liberation libappindicator1 libnss3 lsb-release xdg-utils wget
- npm install --silent
stages:
- test
- build
job 1:
stage: test
script: node_modules/.bin/ng test
job 2:
stage: test
script: node_modules/.bin/ng e2e
release_job:
stage: build
script: node_modules/.bin/ng build --prod --aot
artifacts:
name: "project-$CI_COMMIT_REF_NAME"
paths:
- dist/
only:
- tags
好吧,我不知道您的 node_modules 中有什么,所以很難說。 (將來,我建議發布該信息)我的第一個建議是確保您的 node_modules 中有 Angular cli。 它應該在你的package.json
開發依賴項中。
否則,我建議在全球范圍內使用 Angular cli 並將其作為單獨的實體安裝。
如果你全局安裝它,當你使用ng
而不是使用node_modules/.bin/ng
時,你的 Gitlab CI 實例將能夠找到它
在使用任何ng
命令之前,在安裝階段的旁邊 / 內添加此命令。 (-g 表示全局)。
npm i -g @angular/cli
然后你可以運行ng test
等,而不是引用 node_modules。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.