Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

yarn command not found in gitlab ci

I am trying to configure my gitlab-ci to use yarn install instead of npm install

My current gitlab-ci.yml looks like:

image: node:6.9.4

cache:
  paths:
  - node_modules/
  - .yarn

before_script:
  - apt-get update -qq && apt-get install -qy libelf1

stages:
  - test

test_core:
  stage: test
  script:
  - yarn config set cache-folder .yarn
  - yarn install
  - npm run build
  - npm run test
  tags:
    - 2gb

But the build fails with the error: /bin/bash: line 48: yarn: command not found

is there something I am missing? I tried installing yarn with:

curl -o- -L https://yarnpkg.com/install.sh | bash

this gave me same error, probably because I need to reload the bash environment for the yarn command to become available.

The above config works perfect with npm install.

Please help me resolve this. If there is something missing in my config file or there is something wrong with the gitlab-ci. Thanks.

like image 845
Panshul Avatar asked Mar 02 '17 23:03

Panshul


1 Answers

I use image:node:latest and sometimes it prompts the error. Clear Runner Caches do the job for me. Maybe the runner did not recover to the correct state after doing other jobs.

like image 70
W.Perrin Avatar answered Sep 17 '22 16:09

W.Perrin