11ty upgrading node in netlify

I upgraded the image plugin for 11ty on a small site which had an unintended chain of issues!

I noticed that the Source control had node elements in it, even though I have node_modules in my gitignore file. After some investigation and testing I realised that I must have deployed the site before adding the gitignore. Really should not have node_modules deployed to the repository even though it is private.

To remove the node_modules from the repository I moved the folder up a level and committed and synced the files. That removed the node_modules from the repository. I then moved the node_modules folder back into the local site and ran a build - all was ok.

I checked Netlify and the build had failed.

It turned out (i.e. head scratching and testing for a while) is wasn't my local Node but the Node version on Netlify that needed upgrading - of course it was.

With the node_modules in the build, Netlify had used the node_modules I had provided to create the build - which is a great feature but not what was needed. As soon as I had removed them Netlify used the default node_modules which failed to build because apparently node needed upgrading.

On the Netlify Site Configuration > Build & Deploy > Dependency management (scroll down) to find and configure the Netlify version of Node - it was 15 and I apparently needed 18, so set to 20. Bingo - built and deployed magnificently!

I hope this note helps someone but it is really for me the next time I get this issue on another site and don't realise I fixed it before.

By Simon Cox Published: Tue, Oct 15, 2024

Next short: 11ty Git Commit Messages

Previous short: Newspaper style layout for my content

Latest Shorts

Or all the short articles

Latest articles

Or all the articles