简体   繁体   English

在 Gitlab 上运行 CI 管道时出错

[英]Error while Running CI Pipeline on Gitlab

I am trying to deploy my angular 7 application on gitlab,my .gitlabci.yml contents are as below its giving on pipeline and both jobs are failing.我正在尝试在 gitlab 上部署我的 angular 7 应用程序,我的 .gitlabci.yml 内容如下它在管道上的提供,并且两个工作都失败了。 I want to run tests on CI我想在 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

Getting error:获取错误: 管道错误

Well I don't know what is in your node_modules so it is hard to say.好吧,我不知道您的 node_modules 中有什么,所以很难说。 (In future, I recommend posting that information) My first suggestion would be to ensure you have the Angular cli in your node_modules. (将来,我建议发布该信息)我的第一个建议是确保您的 node_modules 中有 Angular cli。 It should be in your dev dependencies of your package.json .它应该在你的package.json开发依赖项中。

Otherwise I'd suggest using the Angular cli globally and install it as a separate entity.否则,我建议在全球范围内使用 Angular cli 并将其作为单独的实体安装。

If you install it globally, your Gitlab CI instance will be able to find it when you use ng instead of using node_modules/.bin/ng如果你全局安装它,当你使用ng而不是使用node_modules/.bin/ng时,你的 Gitlab CI 实例将能够找到它

Add this command along side / inside your installation stage before you use any ng command.在使用任何ng命令之前,在安装阶段的旁边 / 内添加此命令。 (The -g means globally). (-g 表示全局)。

npm i -g @angular/cli npm i -g @angular/cli

Then you can run ng test etc. instead of referencing node_modules.然后你可以运行ng test等,而不是引用 node_modules。

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

相关问题 Gitlab CI/CD 管道运行问题 - Gitlab CI/CD Pipeline Running Issue 用于 Angular 的 Gitlab 管道 CI/CD .gitlab-ci.yml - Gitlab Pipeline CI/CD .gitlab-ci.yml for Angular 运行 Angular Jasmine 测试的 Gitlab CI 崩溃没有错误 - Gitlab CI running Angular Jasmine tests crashing without error 在 Jenkins 管道中运行 shell 脚本时出错 - Error while running shell script in Jenkin pipeline 使用 GitLab CI 时无法识别 Firebase - Firebase not recognized while using GitLab CI 如何将 Angular 环境变量传递给 Gitlab CI/CD 管道 - How to pass Angular environment variables to Gitlab CI/CD Pipeline gitlab ci角度项目的投掷错误 - gitlab ci throwing error for angular project Azure 和 NX,运行管道时出错:npm:另一个进程,id 为 4224,当前正在运行 ngcc - Azure and NX, error while running a pipeline : npm : Another process, with id 4224, is currently running ngcc Angular 的 Gitlab CI 管道:构建和发布 docker Image./dst 文件夹未找到 - Gitlab CI Pipeline for Angular: Build and Publish docker Image ./dst folder not found 使用Gitlab CI部署Angular App导致tmp目录出错 - Deploying Angular App using the Gitlab CI causes an error in the tmp directory
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM