{"record":{"id":"fbe3704750a1009e","repo":"larksuite/cli","slug":"s-not-found-in-path-w","errorCode":null,"errorMessage":"%s not found in PATH: %w","messagePattern":"(.+?) not found in PATH: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/selfupdate/updater.go","lineNumber":410,"sourceCode":"}\n\nfunc (u *Updater) runSkillsCommand(args ...string) *NpmResult {\n\treturn u.runSkillsCommandInDir(\"\", args...)\n}\n\nfunc (u *Updater) runSkillsCommandInDir(dir string, args ...string) *NpmResult {\n\tif u.SkillsCommandInDirOverride != nil {\n\t\treturn u.SkillsCommandInDirOverride(dir, args...)\n\t}\n\tif u.SkillsCommandOverride != nil {\n\t\treturn u.SkillsCommandOverride(args...)\n\t}\n\tr := &NpmResult{}\n\tdet := u.DetectInstallMethod()\n\tlauncher, cmdArgs := skillsInvocation(det.Method, det.PnpmAvailable, args)\n\tbinPath, err := exec.LookPath(launcher)\n\tif err != nil {\n\t\tr.Err = fmt.Errorf(\"%s not found in PATH: %w\", launcher, err)\n\t\treturn r\n\t}\n\tctx, cancel := context.WithTimeout(context.Background(), skillsUpdateTimeout)\n\tdefer cancel()\n\tcmd := exec.CommandContext(ctx, binPath, cmdArgs...)\n\tcmd.Dir = dir\n\tcmd.Stdout = &r.Stdout\n\tcmd.Stderr = &r.Stderr\n\tr.Err = cmd.Run()\n\tif ctx.Err() == context.DeadlineExceeded {\n\t\tr.Err = fmt.Errorf(\"skills update timed out after %s\", skillsUpdateTimeout)\n\t}\n\treturn r\n}\n\n// VerifyBinary checks that the installed binary reports the expected version\n// by running \"lark-cli --version\" and comparing the version token exactly.\n// Output format is \"lark-cli version X.Y.Z\"; the last field is extracted and","sourceCodeStart":392,"sourceCodeEnd":428,"githubUrl":"https://github.com/larksuite/cli/blob/7fd6ef3c07182257ce776cdc5a614e122d5bd4b3/internal/selfupdate/updater.go#L392-L428","documentation":"runSkillsCommandInDir resolves the launcher binary (chosen by DetectInstallMethod and skillsInvocation — npm or pnpm variants) with exec.LookPath before spawning the skills command. If the launcher is missing from PATH, it returns this error wrapping the LookPath failure.","triggerScenarios":"Calling code paths StageSuite or runSkillsCommand that reach runSkillsCommandInDir when the detected launcher (npm or pnpm) cannot be found via exec.LookPath in the current process environment.","commonSituations":"Package manager removed or installed via a version manager whose shims are absent from PATH; running the CLI under cron/CI/systemd with a minimal PATH; method detection said pnpm was available at startup but it disappeared or vice versa.","solutions":["Ensure the detected launcher (`npm` or `pnpm`) is installed and on PATH of the environment running lark-cli","Run `which npm pnpm` in the same environment (shell/CI job) to confirm resolution","Fix PATH for non-interactive environments (cron/CI) to include the node/package-manager bin directories","Reinstall the CLI with the package manager you actually use so DetectInstallMethod matches reality"],"exampleFix":"// before (cron job with minimal PATH)\n0 3 * * * /usr/local/bin/lark-cli skills update\n// after\n0 3 * * * PATH=/usr/local/bin:/usr/bin:/home/me/.local/share/pnpm:$PATH /usr/local/bin/lark-cli skills update","handlingStrategy":"validation","validationCode":"method := \"npm\" // or from DetectInstallMethod\nif _, err := exec.LookPath(method); err != nil { /* install the launcher or fix PATH before skills commands */ }","typeGuard":"func launcherAvailable(name string) bool { _, err := exec.LookPath(name); return err == nil }","tryCatchPattern":"res := stageResult // NpmResult from StageSuite/runSkillsCommand\nif res.Err != nil {\n\tif strings.Contains(res.Err.Error(), \"not found in PATH\") {\n\t\t// install missing npm/pnpm or export correct PATH, then retry\n\t} else {\n\t\treturn res.Err\n\t}\n}","preventionTips":["Export node/npm/pnpm bin dirs in non-interactive shells (cron, CI, systemd)","Verify `which npm pnpm` in the exact environment running lark-cli","Install the CLI with the package manager you intend to keep using","Avoid uninstalling npm/pnpm while the CLI depends on them for skills management"],"tags":["path","npm","pnpm","skills","environment"],"backgroundTag":"executable-not-found-in-path","analyzedSha":"7fd6ef3c07182257ce776cdc5a614e122d5bd4b3","analyzedAt":"2026-09-04T21:17:44.649Z","contentChangedAt":"2026-09-04T21:17:44.649Z","schemaVersion":2},"datasetVersion":"2026-09-12T02:17:10.037Z"}