{"record":{"id":"3779b3b32670d25b","repo":"sveltejs/kit","slug":"path-relative-input-does-not-exist","errorCode":null,"errorMessage":"${path.relative('.', input)} does not exist","messagePattern":"(.+?) does not exist","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/package/src/index.js","lineNumber":35,"sourceCode":"\n/**\n * @param {import('./types.js').Options} options\n */\nexport async function build(options) {\n\tconst { analyse_code, validate } = create_validator(options);\n\tawait do_build(options, analyse_code);\n\tvalidate();\n}\n\n/**\n * @param {import('./types.js').Options} options\n * @param {(name: string, code: string) => void} analyse_code\n */\nasync function do_build(options, analyse_code) {\n\tconst { input, output, temp, extensions, alias, tsconfig } = normalize_options(options);\n\n\tif (!fs.existsSync(input)) {\n\t\tthrow new Error(`${path.relative('.', input)} does not exist`);\n\t}\n\n\tfs.rmSync(temp, { force: true, recursive: true });\n\tfs.mkdirSync(temp, { recursive: true });\n\n\tconst files = scan(input, extensions);\n\n\tif (options.types) {\n\t\tawait emit_dts(input, temp, output, options.cwd, alias, files, tsconfig);\n\t}\n\n\t/** @type {Map<string, import('typescript').CompilerOptions>} */\n\tconst tsconfig_cache = new Map();\n\n\tfor (const file of files) {\n\t\tawait process_file(\n\t\t\tinput,\n\t\t\ttemp,","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/sveltejs/kit/blob/03f1687fe612ce3d2d9131139b5b188d9cf90c64/packages/package/src/index.js#L17-L53","documentation":"`do_build` validates the resolved input directory (from normalize_options) with `fs.existsSync` before scanning/packaging. If the input directory is missing, it throws an error showing the input path relative to the current directory.","triggerScenarios":"Running `svelte-package` (or `build`/`watch`) when the configured `input` directory (default `src/lib`, or `-i`/package.json `svelte` field value) does not exist on disk.","commonSituations":"Wrong cwd when invoking the CLI; typo'd `-i` path; renamed source folder (e.g. `src` instead of `src/lib`); config in package.json pointing at an old layout.","solutions":["Create the expected directory or fix the path: ensure `src/lib` exists (default input).","Pass the correct input explicitly: `svelte-package -i <dir>`.","Run the command from the package root so relative input paths resolve correctly.","Remove a stale `svelte` field in package.json if it points to a non-existent directory."],"exampleFix":"// before (package.json)\n\"svelte\": \"./src/Lib/index.js\"\n\n// after\n\"svelte\": \"./src/lib/index.js\"","handlingStrategy":"validation","validationCode":"import fs from 'node:fs';\nif (!fs.existsSync('src/lib')) throw new Error('src/lib missing: set -i to your source dir');","typeGuard":null,"tryCatchPattern":"try {\n  await run(['svelte-package']);\n} catch (e) {\n  if (String(e.message).endsWith('does not exist')) {\n    throw new Error('Check the svelte-package -i input path and your cwd');\n  }\n  throw e;\n}","preventionTips":["Run packaging scripts from the package root","Keep the conventional src/lib layout or pass -i explicitly","Remove stale `svelte`/config fields pointing at old paths after refactors"],"tags":["filesystem","path","packaging","configuration"],"backgroundTag":"input-path-not-found","analyzedSha":"03f1687fe612ce3d2d9131139b5b188d9cf90c64","analyzedAt":"2026-09-02T02:01:50.504Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T06:17:21.866Z"}