Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Eleventy 3 no longer finds helper modules when using Node 23 #3625

Open
MarcoZehe opened this issue Jan 19, 2025 · 9 comments
Open

Eleventy 3 no longer finds helper modules when using Node 23 #3625

MarcoZehe opened this issue Jan 19, 2025 · 9 comments

Comments

@MarcoZehe
Copy link

MarcoZehe commented Jan 19, 2025

Operating system

MacOS 15.2

Eleventy

3

Describe the bug

A project that built in v2.0.1 no longer builds in 3.0. The error is that a helper function is undefined or false. However, the line and column pointed to is actually a comment, not the JS module referenced. That is in the line below. Eleventy-Upgrade-Helper does not flag anything amiss with the project right above the error.

Reproduction steps

the lines in question are:

{# Grab other posts that aren’t this one for the 'more from the blog' feed #}
{% set recommendedPosts = helpers.getSiblingContent(collections.blog, page) %}

The error message is:

[11ty] Problem writing Eleventy templates:
[11ty] 1. Having trouble writing to "./dist/apps-fur-iphone-und-ipad-fur-voiceover-zuganglich-machen/index.html" from "./src/articles/2012-06-21-apps-fur-iphone-und-ipad-fur-voiceover-zuganglich-machen.md" (via EleventyTemplateError)
[11ty] 2. (./src/_includes/layouts/post.html) [Line 5, Column 51]
[11ty]   Error: Unable to call `helpers["getSiblingContent"]`, which is undefined or falsey (via Template render error)
[11ty] 
[11ty] Original error stack trace: Template render error: (./src/_includes/layouts/post.html) [Line 5, Column 51]
[11ty]   Error: Unable to call `helpers["getSiblingContent"]`, which is undefined or falsey
[11ty]     at Object.handleError (/Users/marco/Projects/marcos-leben/node_modules/nunjucks/src/runtime.js:227:12)
[11ty]     at Template.root [as rootRenderFunc] (eval at _compile (/Users/marco/Projects/marcos-leben/node_modules/nunjucks/src/environment.js:527:18), <anonymous>:97:14)
[11ty]     at Template.render (/Users/marco/Projects/marcos-leben/node_modules/nunjucks/src/environment.js:454:10)
[11ty]     at file:///Users/marco/Projects/marcos-leben/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:435:10
[11ty]     at new Promise (<anonymous>)
[11ty]     at file:///Users/marco/Projects/marcos-leben/node_modules/@11ty/eleventy/src/Engines/Nunjucks.js:434:11
[11ty]     at file:///Users/marco/Projects/marcos-leben/node_modules/@11ty/eleventy/src/Engines/Html.js:17:12
[11ty]     at process.processTicksAndRejections (node:internal/process/task_queues:105:5)
[11ty]     at async TemplateLayout.renderPageEntry (file:///Users/marco/Projects/marcos-leben/node_modules/@11ty/eleventy/src/TemplateLayout.js:225:22)
[11ty]     at async #renderPageEntryWithLayoutsAndTransforms (file:///Users/marco/Projects/marcos-leben/node_modules/@11ty/eleventy/src/Template.js:856:14)

The line that is being complained about is the one with the comment, column 51 is the position of the first letter after the apostrophe.

Expected behavior

I expected the project to build as it was in 2.0.

Reproduction URL

Clone this to reproduce

Screenshots

No response

@Ryuno-Ki
Copy link
Contributor

Ryuno-Ki commented Jan 19, 2025

I fail to reproduce the behaviour.

Steps I took:

  1. cd /tmp
  2. git clone https://codeberg.org/MarcoZehe/marcos-leben.git
  3. cd marcos-leben
  4. git checkout update-11ty (HEAD is at c2988e4d92d5fea236cec7ff526783f0dddf1208 )
  5. npm install
  6. npm start
  7. Visit http://localhost:8080/apps-fur-iphone-und-ipad-fur-voiceover-zuganglich-machen/ (article from 21st June 2012)

I can observe some warnings from the UpgradePlugin in the console output but aside of that it builds.
Am I missing something?

@MarcoZehe
Copy link
Author

I used npm run production as the command, because I didn't want the server started at that time. However, my working directory was upgraded from eleventy 2 to 3 in a prior step, which worked fine, but after the upgrade to eleventy 3 it failed. I also removed the dist folder to make sure it was clean, but same result. I am at a loss...

@Ryuno-Ki
Copy link
Contributor

Cleaned the dist folder and successfully ran npm run production here.

Perhaps you can run your upgrade in two phases?
From v1 to v2 first (using an older version of the UpgradePlugin as per the warning:

[11ty/eleventy-upgrade-help] ---
[11ty/eleventy-upgrade-help] This plugin will help you migrate from 2.0 to 3.0.
[11ty/eleventy-upgrade-help] If you are migrating from 0.x or 1.x, please use a previous version of this plugin.
[11ty/eleventy-upgrade-help] ---

According to https://github.com/11ty/eleventy-upgrade-help/tree/v2.x it would be installed using npm install @11ty/eleventy-upgrade-help@2.

Then once you are on version 2 have another upgrade to version 3.

@MarcoZehe
Copy link
Author

MarcoZehe commented Jan 19, 2025 via email

@MarcoZehe
Copy link
Author

More info: I clobbered both the dist and node_modules folders, ran npm install again, and got the same result. I also ran an npm audit fix to update some modules that could be updated without issue, no change. Node was installed today via Home Brew which had just before been updated to the current state. No building from source, just the install and update from the HomeBrew website. I don't know what else to try.

@MarcoZehe
Copy link
Author

A helpful user on social media just found that my project doesn't work for them in Node 23.6.0, which is what I am using. That was installed by HomeBrew today. They got it working in Node 22 in a Docker container. So it may be fixed by #3519. However, if it is not, #3577 seems to also cover various Node compatibility issues. Advice would be appreciated if that bug fix currently in 3.0.1 alpha should help with this.

@Ryuno-Ki
Copy link
Contributor

I can see the original branch merged about three hours ago.
Is this resolved now?

@MarcoZehe
Copy link
Author

MarcoZehe commented Jan 20, 2025 via email

@Ryuno-Ki
Copy link
Contributor

Glad you got it working 🥳

Given #3577 (comment) I suspect that odd versions are not officially supported. I would suggest to update the title to indicate it to be related to Node v23.

I could imagine it being added to Eleventy 3.0.1 Milestone once Zach found time to look into it.

@MarcoZehe MarcoZehe changed the title Eleventy 3 no longer finds helper modules Eleventy 3 no longer finds helper modules when using Node 23 Jan 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants