简体   繁体   English

Gitlab CI:未找到纱线

[英]Gitlab CI: Yarn not found

stages:
    - .pre
    - build
    - test

build website:
    image: node:16-alpine
    stage: build
    script:
        - yarn install
        - yarn build
    artifacts:
        paths:
            - build

       

test website:
    image: alpine
    stage: test
    script:
        - yarn global add serve
        - serve -s build 
       
        

I am trying to make an integration test on the gitlab ci but when I commit and try to run this yaml file, it outputs /bin/sh: eval: line 126: yarn: not found我正在尝试对 gitlab ci 进行集成测试,但是当我提交并尝试运行此 yaml 文件时,它输出/bin/sh: eval: line 126: yarn: not found

Is there something I am missing?有什么我想念的吗?

It looks like there is no yarn installed in the image named "alpine" which is used in "test website".看起来在“测试网站”中使用的名为“alpine”的图像中没有安装纱线。 What you can do is:你可以做的是:

  • check if this image has yarn installed if not install yarn utility如果未安装 yarn 实用程序,请检查此图像是否安装了 yarn
  • or simply use image with yarn installed by default或者简单地使用默认安装了纱线的图像

Also it seems like you're not using the artifact in your test, so you will face issue with that when you fixed yarn issue.此外,您似乎没有在测试中使用该工件,因此当您修复纱线问题时,您将面临这个问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM