# Rails: Yarn executable was not detected in the system. Download Yarn at https://yarnpkg.com/en/docs/install

**Code:** `Yarn executable was not detected in the system` · **Category:** Ruby / Rails · **Seen on:** Ruby, Node.js

Rails asset tasks (`assets:precompile`, webpacker/jsbundling) need Node and Yarn but they're not installed/on PATH.

## Meaning

Install Node.js and Yarn (`corepack enable` / `npm i -g yarn`), run `yarn install`, and in Docker/CI install Node in the build stage before precompiling. Rails 7 jsbundling-rails runs `yarn build`; match the Node version in `.node-version`.

## Common causes

- Node/Yarn missing in the image or server
- PATH missing Node (nvm not loaded)
- Webpacker/jsbundling needing `yarn install`
- Different Node version than expected
- Production precompile without devDependencies

## Quick fix

1. `corepack enable && yarn install` before `rails assets:precompile`
2. Install Node in the Docker build stage
3. Ensure PATH includes Node in CI/deploy scripts

## Detailed fix by platform

### Linux

1. `node -v && yarn -v && bin/rails assets:precompile`

## How to diagnose

1. **Node** — Installed?
2. **Yarn** — Available?
3. **Stage** — Docker build?

---
Source: [WhatIsMyError](https://whatismyerror.com/errors/ruby/rails-yarn-executable-not-detected)
