MCPcopy Create free account
hub / github.com/vercel/vercel / getCliNotFoundMessage

Function getCliNotFoundMessage

packages/cli-exec/src/errors.ts:62–97  ·  view source on GitHub ↗
(
  diagnostics: ResolutionDiagnostics
)

Source from the content-addressed store, hash-verified

60 * Builds a not-found error message with diagnostics from local bin resolution.
61 */
62export function getCliNotFoundMessage(
63 diagnostics: ResolutionDiagnostics
64): string {
65 const details: string[] = [];
66 const { localBinSearch } = diagnostics;
67
68 if (localBinSearch.stopReason === 'project-root-marker') {
69 details.push(
70 `Local bin lookup stopped at ${JSON.stringify(localBinSearch.stoppedAt)} (${JSON.stringify(localBinSearch.markerPath)}).`
71 );
72 } else if (localBinSearch.stopReason === 'filesystem-root') {
73 details.push(
74 `No project root marker was found from ${JSON.stringify(localBinSearch.searchRoot)}; local bin lookup reached the filesystem root.`
75 );
76 }
77
78 for (const skippedNodeModules of localBinSearch.skippedNodeModules) {
79 details.push(
80 `Skipped ${JSON.stringify(skippedNodeModules.directory)}: ${skippedNodeModules.reason}.`
81 );
82 }
83
84 for (const skippedLocalBin of diagnostics.skippedLocalBins) {
85 details.push(
86 `Skipped ${JSON.stringify(skippedLocalBin.candidate)}: ${skippedLocalBin.reason}.`
87 );
88 }
89
90 if (details.length === 0) {
91 return 'Unable to find a usable Vercel CLI installation.';
92 }
93
94 return ['Unable to find a usable Vercel CLI installation.', ...details].join(
95 '\n'
96 );
97}
98
99/**
100 * Verifies that the resolved working directory exists and is a directory.

Callers 1

resolveInvocationOrThrowFunction · 0.90

Calls 2

pushMethod · 0.65
joinMethod · 0.45

Tested by

no test coverage detected