diff --git a/packages/gatsby/src/commands/build.js b/packages/gatsby/src/commands/build.js index bf41babab4f97..eab68a6a2b915 100644 --- a/packages/gatsby/src/commands/build.js +++ b/packages/gatsby/src/commands/build.js @@ -61,7 +61,11 @@ module.exports = async function build(program: BuildArgs) { await buildHTML(program, activity).catch(err => { reportFailure( report.stripIndent` - Building static HTML failed for path "${chalk.bold(err.context.path)}" + Building static HTML failed${ + err.context && err.context.path + ? ` for path "${chalk.bold(err.context.path)}"` + : `` + } See our docs page on debugging HTML builds for help https://gatsby.app/debug-html `,