binyamin / eleventy-garden

:seedling: A starter site for building a mind garden with eleventy
https://eleventy-garden.netlify.app
MIT License
450 stars 48 forks source link

Can't serve current version #63

Closed asbjornb closed 2 years ago

asbjornb commented 2 years ago

Describe the bug Can't serve the site currently

To Reproduce

  1. Clone/fork current repo
  2. Run npm install and npm start

Expected behavior Serves the site to localhost:8080

Environment (please complete the following information):

Additional context Not sure if it's a windows thing or some local thing. Output says it can't find head.html in includes. Seeing that it builds fine on Netlify it could be a Windows issue with the mixed forward/backward slashes in the filepath as seen in the log. Relevant part of log:

[11ty] Problem writing Eleventy templates:
[11ty] Having trouble writing template: _site/about/index.html

`TemplateWriterWriteError` was thrown
  Eleventy:EleventyErrorHandler (error stack): TemplateWriterWriteError: Having trouble writing template: _site/about/index.html
  Eleventy:EleventyErrorHandler     at c:\Projects\testgarden\node_modules\@11ty\eleventy\src\TemplateWriter.js:290:15
  Eleventy:EleventyErrorHandler     at async Promise.all (index 1)
  Eleventy:EleventyErrorHandler     at async Eleventy.executeBuild (c:\Projects\testgarden\node_modules\@11ty\eleventy\src\Eleventy.js:958:13)
  Eleventy:EleventyErrorHandler     at async Eleventy.watch (c:\Projects\testgarden\node_modules\@11ty\eleventy\src\Eleventy.js:809:18) +0ms
[11ty] ENOENT: Failed to lookup "head.html" in "c:\Projects\testgarden\includes/", file:./layouts/default.html, line:4, col:5

`RenderError` was thrown
  Eleventy:EleventyErrorHandler (error stack): ENOENT: Failed to lookup "head.html" in "c:\Projects\testgarden\includes/", file:./layouts/default.html, line:4, col:5

Also not sure if this could be related: https://github.com/harttle/liquidjs/issues/395# but specifically adding liquidjs 9.25.1 as dependency and reinstalling doesn't seem to fix the issue.

asbjornb commented 2 years ago

Seems there might be multiple errors. Might have forgotten npm prune while testing - not sure. Can't reproduce the pull request working even when reverting your 3 prior commits and reupping to canary 44. Indeed can't reproduce getting it to work on 44 locally at all it seems. If I either add your quotes to includes, up to .44 or both I am not able to render templates locally. Not sure if node_modules can be removed from .eleventyignore but can't test much in the current state.

binyamin commented 2 years ago

@asbjornb Weird. I'll do some poking around. If you find a way to get to get this working, let me know.

asbjornb commented 2 years ago

Thanks. I will see if I can find something when I get time, but it might be easier to just wait for a fix of the linked issue before spending too much time.

harttle commented 2 years ago

Seems the error posted above is due to a trailing / instead of \, it's fixed on 9.28.1.

https://github.com/harttle/liquidjs/issues/408

Maybe there's multiple errors, but it helps by posting the (next) exact problem.

binyamin commented 2 years ago

Thanks @harttle. That's probably the issue, because I can't reproduce it.

asbjornb commented 2 years ago

Thanks @harttle ! I'm not completely sure I can utilize it until 11ty references the new version. I tried explicitly adding "liquidjs": "^9.28.1" to my package.json file and then doing a combination of deleting node_modules, npm prune, npm install and then running npm start. Error seems similar but doesn't include absolute path in the log.

[11ty] Problem writing Eleventy templates:
[11ty] Having trouble writing template: _site/about/index.html

`TemplateWriterWriteError` was thrown
  Eleventy:EleventyErrorHandler (error stack): TemplateWriterWriteError: Having trouble writing template: _site/about/index.html
  Eleventy:EleventyErrorHandler     at C:\Projects\testgarden\node_modules\@11ty\eleventy\src\TemplateWriter.js:290:15
  Eleventy:EleventyErrorHandler     at async Promise.all (index 1)
  Eleventy:EleventyErrorHandler     at async Eleventy.executeBuild (C:\Projects\testgarden\node_modules\@11ty\eleventy\src\Eleventy.js:958:13)
  Eleventy:EleventyErrorHandler     at async Eleventy.watch (C:\Projects\testgarden\node_modules\@11ty\eleventy\src\Eleventy.js:809:18) +0ms
[11ty] ENOENT: Failed to lookup "head.html" in "includes", file:./layouts/default.html, line:4, col:5

`RenderError` was thrown
  Eleventy:EleventyErrorHandler (error stack): ENOENT: Failed to lookup "head.html" in "includes", file:./layouts/default.html, line:4, col:5

I will try to see if I can reproduce on another windows pc and then a linux machine tomorrow. The repo I use is at https://github.com/asbjornb/testgarden I should have forked but had a bit of trouble since I already have a fork - should probably just have branched on that. Can do that tomorrow too.

asbjornb commented 2 years ago

It seems the new 11ty beta didn't help although it ups the liquidjs reference. Going back to canary.23 works still. Not sure if this is unrelated to the liquidjs version. Other syntax might have changed in between versions or something. I owe some more tests when I can fin the time.

c:\Projects\personal-site>npm start

> eleventy-garden@1.0.0 start c:\Projects\personal-site
> eleventy --serve --quiet

[11ty] Problem writing Eleventy templates: (more in DEBUG output)
[11ty] > Having trouble writing template: _site/about/index.html

`TemplateWriterWriteError` was thrown
[11ty] > illegal filename "undefined", file:./content/layouts/default.html, line:4, col:5

`RenderError` was thrown
[11ty] > illegal filename "undefined"

`AssertionError` was thrown:
[11ty]     AssertionError: illegal filename "undefined"
        at new AssertionError (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:653:28)
        at assert (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:800:15)
        at Object.<anonymous> (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:3047:21)
        at step (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:84:23)
        at Object.next (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:65:53)
        at reduce (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:1021:25)
        at Object.then (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:989:43)
        at reduce (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:1028:40)
        at toThenable (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:1016:16)
        at reduce (c:\Projects\personal-site\node_modules\liquidjs\dist\liquid.node.cjs.js:1028:16)
[11ty] Wrote 0 files in 0.14 seconds (v1.0.0-beta.5)

and

[11ty] Problem writing Eleventy templates:
[11ty] Having trouble writing template: _site/about/index.html

`TemplateWriterWriteError` was thrown
  Eleventy:EleventyErrorHandler (error stack): TemplateWriterWriteError: Having trouble writing template: _site/about/index.html
  Eleventy:EleventyErrorHandler     at c:\Projects\personal-site\node_modules\@11ty\eleventy\src\TemplateWriter.js:289:15
  Eleventy:EleventyErrorHandler     at async Promise.all (index 1)
  Eleventy:EleventyErrorHandler     at async Eleventy.executeBuild (c:\Projects\personal-site\node_modules\@11ty\eleventy\src\Eleventy.js:960:13) +0ms
[11ty] illegal filename "undefined", file:./content/layouts/default.html, line:4, col:5

`RenderError` was thrown
  Eleventy:EleventyErrorHandler (error stack): illegal filename "undefined", file:./content/layouts/default.html, line:4, col:5
  Eleventy:EleventyErrorHandler    2| <html lang="en">
  Eleventy:EleventyErrorHandler    3| <head>
  Eleventy:EleventyErrorHandler >> 4|     {% include head.html %}
  Eleventy:EleventyErrorHandler    5| </head>
  Eleventy:EleventyErrorHandler    6| <body>
  Eleventy:EleventyErrorHandler    7|     <header class="page-header">
  Eleventy:EleventyErrorHandler RenderError: illegal filename "undefined", file:./content/layouts/default.html, line:4, col:5
asbjornb commented 2 years ago

Updating to beta then readding the quotes on <% include-statements seems to have solved this. I'm not sure if upping the dependency in eleventy garden to the beta version would be ok with you but it would close this issue :)

binyamin commented 2 years ago

@asbjornb that would be totally fine. Will do.

binyamin commented 2 years ago

commit 1c7ce82db962252bda720be36690b9a315318453 should fix this