setup-node: Error: Unable to locate executable file: yarn. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
I have
            uses: actions/setup-node@v3
              with:
                  node-version: 16
                  cache: 'yarn'
Maybe my expectation is incorrect, but I would expect this package to setup node and yarn on the machine.
Description:
crashes with Error: Unable to locate executable file: yarn. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
Action version: 3
Platform:
- Ubuntu
- macOS
- Windows
Runner type:
- Hosted
- Self-hosted
Tools version: node 16
Repro steps:
Expected behavior: yarn get’s installed as part of this step
Actual behavior: crashes with
Run actions/setup-node@v3
Found in cache @ /Users/runner/actions-runner/_work/_tool/node/16.15.0/arm64
Error: Unable to locate executable file: yarn. Please verify either the file path exists or the file can be found within a directory specified by the PATH environment variable. Also check the file mode to verify the file is executable.
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 16 (2 by maintainers)
Also running into this on self-hosted. Used to work fine on GitHub hosted runners.
A bit odd indeed that yarn is a precondition for setting up node here.
I just ran into this problem, and I’m curious why the setup-node action doesn’t you know, setup node? Doesn’t pre-installing tools on the self-hosted runner defeat the purpose?
IMO the action should just call
corepackas part of the install. If the repo haspackageManagerset, everything will just work.of course I don’t. I do not know why I was expecting this action to set it up. Sorry
@dmitry-shibanov I disagree,
yarn/pnpmare not some random extra tools, they are pretty core to the NodeJS ecosystem and used pretty extensively. Thissetup-nodeaction acknowledges this by giving support for caching dependencies installed with those tools. IMHO, it doesn’t make sense that I need to somehow, installyarnafter usingsetup-node, loosing the ability to use the build in caching support and hacking it like @neseleznev showed.Hello @capaj. Thank you for your report. Do you have yarn preinstalled on your self-hosted runner ?
Agree with @milesj here. Especially considering that
corepackmakes installing yarn so easy, seems like setup-node should take care of this implicitly whenyarnis set as cache type, at least for newer node versions =)I don’t think you’re dumb at all! 😅
@neseleznev totally agree with you, to me it sounds like
yarnandpnpmare tools that should be controlled bysetup-node, specially if this action supports cache for those, otherwise, it’s contradictory.Hello @milesj. The hosted runners have preinstalled versions of software such as yarn node and etc. The main purpose of setup-node is to set up Nodejs on the machine that is why we’re not going to install some extra tools. Besides, that if the action had been installing tools by default it would require clean up machine from it. It looks like something out of scope of action.
tldr: add step to install
yarnthinks you
I hit this today when using
act.That’s not dumb at all. It’s quite opposite — I have to preinstall
yarnglobally (Node.jsnpmpackage) to the runner before installing Node.js 🤯I feel frustrated. For those who’s with me, try the approach to cache the whole
node_modulesas described in https://oozou.com/blog/ci-cd-tips-improve-your-ci-cd-with-cache-github-version-209Thus, my final action looks like
I’ve seen an action to run yarn without installing it on the runner
e.g.
https://github.com/marketplace/actions/github-action-for-yarn