Gitlab CI: Yarn not found

Viewed 20
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

Is there something I am missing?

1 Answers

It looks like there is no yarn installed in the image named "alpine" which is used in "test website". What you can do is:

  • check if this image has yarn installed if not install yarn utility
  • 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.

Related