{"record":{"id":"e0d9abc217a07fe8","repo":"pulumi/pulumi","slug":"could-not-find-yarn-executable-install-yarn-and","errorCode":null,"errorMessage":"Could not find `yarn` executable.\nInstall yarn and make sure it is in your PATH.","messagePattern":"Could not find `yarn` executable\\.\nInstall yarn and make sure it is in your PATH\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"sdk/nodejs/npm/yarn.go","lineNumber":49,"sourceCode":"\t\"github.com/pulumi/pulumi/sdk/v3/go/common/util/errutil\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/common/util/fsutil\"\n\t\"github.com/pulumi/pulumi/sdk/v3/go/common/util/logging\"\n)\n\n// yarnClassic is an implementation of PackageManager that uses Yarn Classic,\n// which is the v1.x.y line, to install dependencies.\ntype yarnClassic struct {\n\texecutable string\n}\n\n// Assert that YarnClassic is an instance of PackageManager.\nvar _ PackageManager = &yarnClassic{}\n\nfunc newYarnClassic() (*yarnClassic, error) {\n\tyarnPath, err := exec.LookPath(\"yarn\")\n\tif err != nil {\n\t\tif errors.Is(err, exec.ErrNotFound) {\n\t\t\treturn nil, errors.New(\"Could not find `yarn` executable.\\n\" +\n\t\t\t\t\"Install yarn and make sure it is in your PATH.\")\n\t\t}\n\t\treturn nil, err\n\t}\n\treturn &yarnClassic{\n\t\texecutable: yarnPath,\n\t}, nil\n}\n\nfunc (yarn *yarnClassic) Name() string {\n\treturn \"yarn\"\n}\n\nfunc (yarn *yarnClassic) Version() (semver.Version, error) {\n\tcmd := exec.Command(yarn.executable, \"--version\")\n\toutput, err := cmd.Output()\n\tif err != nil {\n\t\treturn semver.Version{}, errutil.ErrorWithStderr(err, cmd.String())","sourceCodeStart":31,"sourceCodeEnd":67,"githubUrl":"https://github.com/pulumi/pulumi/blob/793f7b2e160db4321fb7fb6b0607461e01cb251e/sdk/nodejs/npm/yarn.go#L31-L67","documentation":"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.","triggerScenarios":"Using the yarn package-manager integration (e.g. PULUMI_YARN / yarn-based NodeJS project install) when no 'yarn' binary is resolvable via PATH.","commonSituations":"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.","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"],"exampleFix":"// before: command not found\npulumi install\n// after\ncorepack enable && pulumi install","handlingStrategy":"validation","validationCode":"which yarn || { echo 'yarn not found; run: corepack enable'; exit 1; }\nyarn --version","typeGuard":null,"tryCatchPattern":"y, err := newYarnClassic()\nif err != nil {\n  if strings.Contains(err.Error(), \"Could not find `yarn` executable\") {\n    // fall back to npm or instruct user to install yarn\n  }\n  return err\n}","preventionTips":["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"],"tags":["yarn","missing-executable","path","nodejs"],"backgroundTag":"missing-executable-on-path","analyzedSha":"793f7b2e160db4321fb7fb6b0607461e01cb251e","analyzedAt":"2026-08-31T09:36:43.099Z","schemaVersion":2},"datasetVersion":"2026-08-31T14:17:45.589Z"}