Skip to content

Set default path for Yarn cache to a path writable by gitlab-runner user

Using yarn currently can result in it trying to write to a system location:

yarn version
yarn version v1.22.10
error An unexpected error occurred: "EACCES: permission denied, mkdir '/usr/local/Caches'".
info If you think this is a bug, please open a bug report with the information provided in "/Users/gitlab-runner/builds/YSXTuzd5/0/modernhealth/marionette/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/version for documentation about this command.

Proposal

Change the cache location by defining an environment variable in the gitlab-runner account ~/.profile file pointing to e.g. $HOME/.cache/yarn.

See https://gitlab.com/gitlab-com/macos-buildcloud-runners-beta/-/issues/13#note_420882167

Edited by Pedro Pombeiro