diff --git a/packages/@sanity/cli/src/util/remoteTemplate.ts b/packages/@sanity/cli/src/util/remoteTemplate.ts index 992837060dc..17acc20a08f 100644 --- a/packages/@sanity/cli/src/util/remoteTemplate.ts +++ b/packages/@sanity/cli/src/util/remoteTemplate.ts @@ -217,9 +217,11 @@ export async function applyEnvVariables( await access(join(root, file)) return file }), - ).catch(() => { - throw new Error('Could not find .env.template, .env.example or .env.local.example file') - }) + ).catch(() => undefined) + + if (!templatePath) { + return // No template .env file found, skip + } try { const templateContent = await readFile(join(root, templatePath), 'utf8')