diff --git a/packages/gatsby-cli/src/init-starter.js b/packages/gatsby-cli/src/init-starter.js index 142e6fc00c364..2bed30e3a8288 100644 --- a/packages/gatsby-cli/src/init-starter.js +++ b/packages/gatsby-cli/src/init-starter.js @@ -51,6 +51,16 @@ const copy = async (starterPath: string, rootPath: string) => { if (!fs.existsSync(starterPath)) { throw new Error(`starter ${starterPath} doesn't exist`) } + + if (starterPath === `.`) { + throw new Error( + `You can't create a starter from the existing directory. If you want to + create a new site in the current directory, the trailing dot isn't + necessary. If you want to create a new site from a local starter, run + something like "gatsby new new-gatsby-site ../my-gatsby-starter"` + ) + } + report.info(`Creating new site from local starter: ${starterPath}`) report.log(`Copying local starter to ${rootPath} ...`)