pulumi/pulumi · error
Could not find `yarn` executable. Install yarn and make sure
Error message
Could not find `yarn` executable. Install yarn and make sure it is in your PATH.
What it means
newYarnClassic could not find the 'yarn' executable on PATH (exec.LookPath returned exec.ErrNotFound), so Yarn Classic package-manager support cannot be used. The SDK raises a descriptive error telling the user to install yarn.
Source
Thrown at sdk/nodejs/npm/yarn.go:49
"github.com/pulumi/pulumi/sdk/v3/go/common/util/errutil"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/fsutil"
"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging"
)
// yarnClassic is an implementation of PackageManager that uses Yarn Classic,
// which is the v1.x.y line, to install dependencies.
type yarnClassic struct {
executable string
}
// Assert that YarnClassic is an instance of PackageManager.
var _ PackageManager = &yarnClassic{}
func newYarnClassic() (*yarnClassic, error) {
yarnPath, err := exec.LookPath("yarn")
if err != nil {
if errors.Is(err, exec.ErrNotFound) {
return nil, errors.New("Could not find `yarn` executable.\n" +
"Install yarn and make sure it is in your PATH.")
}
return nil, err
}
return &yarnClassic{
executable: yarnPath,
}, nil
}
func (yarn *yarnClassic) Name() string {
return "yarn"
}
func (yarn *yarnClassic) Version() (semver.Version, error) {
cmd := exec.Command(yarn.executable, "--version")
output, err := cmd.Output()
if err != nil {
return semver.Version{}, errutil.ErrorWithStderr(err, cmd.String())View on GitHub (pinned to 793f7b2e16)
Solutions
- Install yarn: corepack enable (ships with Node) or npm install -g yarn
- Verify with 'which yarn' / 'yarn --version' in the same shell that runs pulumi
- Add the yarn bin directory to PATH in your shell profile, CI environment, or container image
- Alternatively switch the project to npm or pnpm if yarn is not required
Example fix
// before: command not found pulumi install // after corepack enable && pulumi install
Defensive patterns
Strategy: validation
Validate before calling
which yarn || { echo 'yarn not found; run: corepack enable'; exit 1; }
yarn --version Try / catch
y, err := newYarnClassic()
if err != nil {
if strings.Contains(err.Error(), "Could not find `yarn` executable") {
// fall back to npm or instruct user to install yarn
}
return err
} Prevention
- Install yarn in CI images (corepack enable or npm i -g yarn)
- Verify PATH includes the version-manager bin dir (nvm/volta/corepack shims)
- Prefer npm or pnpm when yarn is not required
- Add a preflight 'yarn --version' check to environment bootstrap scripts
When it happens
Trigger: Using the yarn package-manager integration (e.g. PULUMI_YARN / yarn-based NodeJS project install) when no 'yarn' binary is resolvable via PATH.
Common situations: Yarn never installed on the machine/CI image; yarn installed via a version manager (nvm/volta/corepack) whose bin dir isn't on PATH in the current shell or container; running pulumi from a GUI/service with a minimal PATH.
Related errors
- Problem executing program (could not run language executor):
- error while looking for fnm: %w
- could not find executable %q: %w
- find npm: %w
- the project's manifest is package.yaml, which requires pnpm,
AI-assisted analysis of pulumi/pulumi@793f7b2e16 (2026-08-31).
Data as JSON: /api/errors/e0d9abc217a07fe8.
Report an issue: GitHub.