zip-it-and-ship-it icon indicating copy to clipboard operation
zip-it-and-ship-it copied to clipboard

Function cannot be zipped if using yarn berry/yarn 2

Open houfu opened this issue 5 years ago • 1 comments

- 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.

  1. Set up a repository with yarn berry
  2. Write a function with a dependency.
  3. Try to deploy at Netlify website.
  4. 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

houfu avatar Feb 20 '21 17:02 houfu

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.

FizzBuzz791 avatar Jun 27 '21 03:06 FizzBuzz791