[英]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
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.