Skip to content

Commit

Permalink
refactor(upgrade): improve error message when package manager cannot …
Browse files Browse the repository at this point in the history
…be detected (#270)
  • Loading branch information
L422Y authored Nov 2, 2023
1 parent 734a194 commit 67d6e1c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/commands/upgrade.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,9 @@ export default defineCommand({
// Check package manager
const packageManager = getPackageManager(cwd)
if (!packageManager) {
console.error('Cannot detect Package Manager in', cwd)
consola.error(
`Unable to determine the package manager used by this project.\n\nNo lock files found in \`${cwd}\`, and no \`packageManager\` field specified in \`package.json\`.\n\nPlease either add the \`packageManager\` field to \`package.json\` or execute the installation command for your package manager. For example, you can use \`pnpm i\`, \`npm i\`, \`bun i\`, or \`yarn i\`, and then try again.`,
)
process.exit(1)
}
const packageManagerVersion = execSync(`${packageManager} --version`)
Expand Down

0 comments on commit 67d6e1c

Please sign in to comment.