Function cannot be zipped if using yarn berry/yarn 2
- Do you want to request a feature or report a bug? Bug
- What is the current behavior?
If yarn berry is set, deploying a Netlify function with a node module dependency fails with
A Netlify Function failed to require one of its dependencies.
- If the current behavior is a bug, please provide the steps to reproduce.
- Set up a repository with yarn berry
- Write a function with a dependency.
- Try to deploy at Netlify website.
- Website using yarn berry deploys with no issues, but the function fails to build as it is missing the dependency.
- What is the expected behavior?
The function should deploy.
My suspicion is that the dependencies are searched in node_modules while yarn 2 is at .yarn\cache
You can get the expected behaviour by downgrading to yarn classic.
- Please mention your node.js, and operating system version. netlify-cli/3.8.4 linux-x64 node-v14.15.2
I'm not quite getting the same error, but suspect it's highly related.
I'm using Berry and Zero Installs, the bundling part seems broken as I get "cannot find module" when trying to run the deployed function.