Yarn team 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 this:

 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 failed with the error: /bin/bash: line 48: yarn: command not found

Is there something I am missing? I tried to set the yarn with:

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

this gave me the same error, perhaps because I need to reload the bash environment so that the thread command becomes available.

The above configuration works with npm install .

Please help me solve this problem. If something is missing in my configuration file, or something is wrong with gitlab-ci. Thanks.

+5
source share
2 answers

Solved it using the latest official docker node image. Since the image: 6.10.0 , the yarn is set by default on the image.

But if you need node-gyp to build any package, you need to install it by adding a line to the script:

yarn global add node-gyp

+10
source

Add the following to your ci script after the yarn has been installed:

 export PATH=$HOME/.yarn/bin:$PATH 
+1
source

Source: https://habr.com/ru/post/1264964/


All Articles