Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Yarn is not installed

See original GitHub issue

We are using a self-hosted runner and using this action to setup-node and install yarn.

I know on github-hosted runners, yarn is already pre-installed but it would be good if yarn was installed by this action for those of us using self-hosted.

Running setup-node with the following workflow and it works

    node-version: 12.13.0
    always-auth: true

/usr/bin/tar xz --warning=no-unknown-keyword -C /actions-runner/_work/_temp/febce1c0-314e-4a14-9a65-5bde8a990b71 -f /actions-runner/_work/_temp/d4bf33ab-571e-458e-9495-bd6c5b994814
/actions-runner/_work/_tool/node/12.13.0/x64/bin/node --version
/actions-runner/_work/_tool/node/12.13.0/x64/bin/npm --version

Note that node and npm are installed.

A later step in the workflow then attempts to run yarn:

Run yarn install --ignore-scripts --frozen-lockfile
/actions-runner/_work/_temp/ line 1: yarn: command not found
##[error]Process completed with exit code 127.

This of course works on github hosted runners just fine, but since I just migrated to an EC2 instance that doesn’t have yarn installed, I am now having issues.

Issue Analytics

  • State:open
  • Created 3 years ago
  • Reactions:91
  • Comments:14

github_iconTop GitHub Comments

GoldFlshcommented, Nov 10, 2020

Workaround is to install yarn yourself using npm (after running this action)

- name: Install Yarn
   run: npm install -g yarn

and later can uninstall it -

- name: Uninstall Yarn
   if: always()
   run: npm uninstall -g yarn

While this works, I find it rather hacky. It would be good for this action to not need to rely on github’s instances to have yarn package installed.

EDIT: I wanted to add the documentation acts as if yarn is a given, since it has sections on usage with yarn Publish to npmjs and GPR with yarn:. Perhaps some clarification in that section that if you’re on self-hosted runners you will need to install yarn yourself via npm install -g yarn and uninstall it at the end of your job with npm uninstall -g yarn

davide-bertola-deltatrecommented, Nov 4, 2021

Note that if you use with: cache: yarn this action will fail if you don’t have yarn pre-installed… But since you need node to install yarn… you can’t get out of this without running this action twice or using other actions.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Windows. There are three options for installing Yarn on Windows. Download the installer. This will give you a .msi file that when run...
Read more >
yarn: command not found error [Solved]
To solve the error "yarn: command not found", install the yarn package globally by running npm install -g yarn and restart your terminal....
Read more >
npm install yarn -g not working · Issue #599 · yarnpkg/yarn
Trying to install it as it says in the intro post and I'm running into an issue with the bin not being linked....
Read more >
4 Methods for How to Install Yarn on Windows Server
First, you need to download the Yarn install package. Download the Yarn .msi installer from the official Yarn website. Step 2: Locate and...
Read more >
How to fix the Yarn Installation Error "The term yarn is not ...
This is a snippet from my previous video hence there is not intro and ... how to install yarn the term node is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found