mirror of
https://github.com/nuxt/nuxt.git
synced 2025-01-18 17:35:57 +00:00
fix(nuxi): provide install advice if git fails (#923)
This commit is contained in:
parent
f2c42bcbba
commit
81293ff195
@ -32,10 +32,18 @@ export default defineNuxtCommand({
|
|||||||
const formatArgs = msg => msg.replace('options.', '--')
|
const formatArgs = msg => msg.replace('options.', '--')
|
||||||
degit.on('warn', event => consola.warn(formatArgs(event.message)))
|
degit.on('warn', event => consola.warn(formatArgs(event.message)))
|
||||||
degit.on('info', event => consola.info(formatArgs(event.message)))
|
degit.on('info', event => consola.info(formatArgs(event.message)))
|
||||||
|
try {
|
||||||
await degit.clone(dstDir)
|
await degit.clone(dstDir)
|
||||||
|
} catch (e) {
|
||||||
|
if (e.toString().includes('could not find commit hash')) {
|
||||||
|
consola.warn(`Make sure you have installed \`git\` correctly`)
|
||||||
|
process.exit(1)
|
||||||
|
}
|
||||||
|
throw e
|
||||||
|
}
|
||||||
|
|
||||||
// Show neet steps
|
// Show neet steps
|
||||||
console.log(`\n 🎉 Another Nuxt project just made. ${superb.random()}! Next steps:` + [
|
console.log(`\n 🎉 Another ${superb.random()} Nuxt project just made! Next steps:` + [
|
||||||
'',
|
'',
|
||||||
`📁 \`cd ${rpath(dstDir)}\``,
|
`📁 \`cd ${rpath(dstDir)}\``,
|
||||||
'💿 Install dependencies with `npm install` or `yarn install`',
|
'💿 Install dependencies with `npm install` or `yarn install`',
|
||||||
|
Loading…
Reference in New Issue
Block a user