带有gitlab的Angular 5 CICD

时间:2019-01-10 08:28:53

标签: angular5 gitlab

我是CICD的新手,使用gitlab执行cicd。 如何配置.gitlab-ci.yml文件。

下面是我的.gitlab-ci.yml代码。

image: node:8.11.1

stages:
  - build 

cache:
  paths:
    - node_modules/

install_dependencies:
  stage: build
  script:
     - npm install -g @angular/cli@1.6.6
     - npm install
     - ./node_modules/@angular/cli/bin/ng start
     - ./node_modules/@angular/cli/bin/ng build

我遇到如下错误

在ini格式的文件中指定配置:     /root/.npmrc 或在命令行上通过以下命令:npm --key value 可以通过以下方式查看配置信息:npm help config

npm@5.6.0 / usr / local / lib / node_modules / npm

错误:作业失败:退出代码1

$ ./node_modules/@angular/cli/bin/ng服务打开

/ bin / bash:第74行:./node_modules/@angular/cli/bin/ng:没有此类文件或目录

1 个答案:

答案 0 :(得分:0)

以下示例可能会有所帮助

用您的项目名称替换name-of-my-project

image: node:8.11.1

pages:
  cache:
    paths:
    - node_modules/

  stage: deploy
  script:
  - npm install -g @angular/cli@1.6.6
  - npm install
  - ng build --prod --base-href /name-of-my-project/
  - mkdir public
  - mv prod/name-of-my-project/* public/
  artifacts:
    paths:
    - public
  only:
  - master
相关问题