Installing Yarn in Machine Executor

Hey folks! After some prodding I’ve gotten my dependencies (Postgres) to run in docker-compose in a machine executor, but my tests run outside of that. I’d like to use yarn to run them (yarn test:e2e), but yarn isn’t installed by default on machine executors (I’m using Ubuntu btw). I tried installing yarn by following the instructions (running curl -o- -L https://yarnpkg.com/install.sh | bash), which reports success, but then the next step immediately says “yarn: command not found”. Did I miss something?

Thanks!

1 Like

Hi @StevenLangbroek, welcome to Discuss!

I believe after installing yarn you will need to ensure it’s made available in the bash profile for the build, you can do so with something like this:

      - run: |
          curl -o- -L https://yarnpkg.com/install.sh | bash
          echo 'export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"' >> $BASH_ENV

Can you give the above a try and let me know if you continue to encounter issues running yarn? Thanks!

2 Likes

Works like a charm :slight_smile: thanks!

2 Likes

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.