Netlify site name: wheresbaldo-dev.netlify.app
Issue: I’m getting an “Uncaught Exception” error when my Netlify scheduled function runs, saying a package isn’t being found:
{“errorType”:“Error”,“errorMessage”:“Cannot find package ‘prettier’ imported from /var/task/netlify/functions/sitemap-rss-regen.mjs”
It appears to be getting deployed without issue, as it’s showing scheduled correctly.
I suspected this might be due to me using Yarn Berry (with no node_modules folder) and so I asked “Ask Netlify” if using Yarn Berry is supported, and it doesn’t seem like that’s the case. Quoting it’s reply:
If you’re using Yarn Berry (Yarn 2.0.0 or later) with Netlify, you must add
nodeLinker: node-modules
to a.yarnrc.yml
file, which is generally stored in your repository root. This is because Netlify depends on thenode_modules
folder tree that’s generated with this setting. The Plug’n’Play feature of Yarn is not currently supported on Netlify.
Specifics about the package manager aren’t listed in any of the official docs that I could see, although perhaps I missed it.
So, I just want to confirm, are the functions being built/deployed using the package manager, or only Node.JS directly?
If the latter, are there any plans to change it to use the package manager for deployment?
And if not, it should be noted in the official docs that the node_modules folder must be present, and therefore Yarn Berry (or zero-installs) can’t be used.