首页 > 解决方案 > Gitlab CI:作业配置应包含至少一项可见作业

问题描述

我已经开始在 Gitlab CI 上构建我的 .gitlab-ci.yml 所以我用这样的简单阶段创建它

image: node:alpine

variables:
  PUBLIC_URL: /my-app

cache:
  paths:
    - node_modules

stages:
  - build
  - deploy

install_dependencies:
  stage: build
  script:
    - npm install
  artifacts:
    paths:
      - node_modules/

deploy_to_cloud:
  stage: deploy
  script:
    - echo Deployed

但作业失败并回复:在您的 .gitlab-ci.yml 中发现错误:

“作业配置应至少包含一项可见作业”

标签: gitcontinuous-integrationgitlabyamlgitlab-ci

解决方案


yml 中可能存在某种不可见的 BOM 或其他无效字符。尝试使用另一个编辑器对其进行验证以进行检查。如果您什么也没找到,请尝试删除该文件并使用另一种方法重新创建它。


推荐阅读