sveltejs/kit · warning

No netlify.toml found. Using default publish directory. Cons

Error message

No netlify.toml found. Using default publish directory. Consult https://svelte.dev/docs/kit/adapter-netlify#usage for more details

What it means

adapter-netlify reads the publish directory from a netlify.toml file in the project root. When none is found, get_publish_directory logs this warning and falls back to Netlify's default publish directory, which may not match where the adapter writes output. The warning points to the adapter-netlify docs so the user adds proper configuration.

Source

Thrown at packages/adapter-netlify/utils.js:67

 * @param {import('@sveltejs/kit').Builder} builder
 * @returns {string | undefined}
 */
export function get_publish_directory(netlify_config, builder) {
	if (netlify_config) {
		if (!netlify_config.build?.publish) {
			builder.log.minor('No publish directory specified in netlify.toml, using default');
			return;
		}

		if (resolve(netlify_config.build.publish) === process.cwd()) {
			throw new Error(
				'The publish directory cannot be set to the site root. Please change it to another value such as "build" in netlify.toml.'
			);
		}
		return netlify_config.build.publish;
	}

	builder.log.warn(
		'No netlify.toml found. Using default publish directory. Consult https://svelte.dev/docs/kit/adapter-netlify#usage for more details'
	);
}

/**
 * @param {*} value
 * @returns {string}
 */
export function s(value) {
	return JSON.stringify(value, null, '\t');
}

View on GitHub (pinned to 03f1687fe6)

Solutions

  1. Create a netlify.toml in the project root with a [build] section specifying the publish directory.
  2. Follow the adapter-netlify docs (https://svelte.dev/docs/kit/adapter-netlify#usage) for the recommended config.
  3. If the file exists, ensure it is committed and present in the build working directory.

Example fix

// netlify.toml
# before (missing)
# after
[build]
  command = "npm run build"
  publish = ".svelte-kit/cloudflare"
# for adapter-netlify typically:
#   publish = ".svelte-kit/netlify"
Defensive patterns

Strategy: validation

Validate before calling

import { existsSync } from 'node:fs';
if (!existsSync('netlify.toml')) {
  console.warn('netlify.toml missing: adapter-netlify will use the default publish directory');
}

Prevention

When it happens

Trigger: Calling adapt() with adapter-netlify when no netlify.toml exists in the project root (so `netlify_config.build.publish` is undefined) and NETLIFY environment config is unavailable.

Common situations: Fresh SvelteKit projects scaffolded without netlify.toml; deploying to Netlify where the file was gitignored; CI builds run outside the Netlify environment where the config is normally auto-detected.

Related errors


AI-assisted analysis of sveltejs/kit@03f1687fe6 (2026-09-02). Data as JSON: /api/errors/ac1ba96db32f8ea0. Report an issue: GitHub.