11ty / eleventy

A simpler site generator. Transforms a directory of templates (of varying types) into HTML.
https://www.11ty.dev/
MIT License
17.1k stars 493 forks source link

eleventy --serve returning 404 for all paths whenever using non-default output directory #2629

Closed iatenothingbutriceforthreedays closed 1 year ago

iatenothingbutriceforthreedays commented 1 year ago

Describe the bug I'm running npx eleventy --serve --input=src --output=docs, I can see that the site is built correctly into docs but when I access localhost:8080/ I get 404s no matter what path I try to view.

npx eleventy --serve --input=src (using default output dir _site) works fine - I can access all the site content from localhost:8080.

Environment:

Additional context Last few lines of output with DEBUG=Eleventy*:

  Eleventy Finished writing templates. +85ms
  Eleventy 
  Eleventy       Getting frustrated? Have a suggestion/feature request/feedback?
  Eleventy       I want to hear it! Open an issue: https://github.com/11ty/eleventy/issues/new +0ms
  Eleventy Watching for changes to: [ './src/**/*.liquid', './src/**/*.ejs', './src/**/*.md', './src/**/*.hbs', './src/**/*.mustache', './src/**/*.haml', './src/**/*.pug', './src/**/*.njk', './src/**/*.html', './src/**/*.11ty.js', './src/**/*.11ty.cjs', './src/_includes/**', './src/_data/**', './.eleventy.js', './eleventy.config.js', './eleventy.config.cjs', './src/**/*.json', './src/**/*.11tydata.cjs', './src/**/*.11tydata.js', './nunjucks-env.js' ] +6ms
  Eleventy Ignoring watcher changes to: [ '**/node_modules/**', '.git/**', 'node_modules/**', 'docs/**' ] +0ms
  Eleventy:Benchmark Benchmark      9ms NaN%     1× (Watch) Start up --watch +10ms
  Eleventy:Benchmark Benchmark      5ms NaN%     1× (Watch) Watching JavaScript Dependencies (disable with `eleventyConfig.setWatchJavaScriptDependencies(false)`) +0ms
[11ty] Watching…
  Eleventy:TemplatePassthroughManager `addPassthroughCopy` config API paths: {} +56ms
  Eleventy:TemplatePassthroughManager `addPassthroughCopy` config API normalized paths: [] +0ms
  Eleventy Ignoring watcher changes to: [ '**/node_modules/**', '.git/**', 'node_modules/**', 'docs/**' ] +4ms
  Eleventy:Logger Server at http://localhost:8080/ +33ms
  EleventyDevServer / { statusCode: 404 } +0ms
  EleventyDevServer / { statusCode: 404 } +2s
  EleventyDevServer /docs { statusCode: 404 } +5s
  EleventyDevServer /_site { statusCode: 404 } +3s
  EleventyDevServer /index.html { statusCode: 404 } +3s
TigersWay commented 1 year ago

Probably duplicate with #2311

zachleat commented 1 year ago

Yes, thank you @TigersWay! Please subscribe to #2311, will ship with 2.0.0-canary.19