-
Notifications
You must be signed in to change notification settings - Fork 57
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
Fix support for Yarn Plug'n Play in the plugins execution #1535
Comments
Thanks for looking at this! A few notes I forgot to mention yesterday:
Also, how could we detect the usage of Yarn v2?
|
Thanks a lot for this information, this is very helpful! ❤️ |
I am using yarn v2 on xstyled project, it works fine but it looks like caching is not really effective. See this build: https://app.netlify.com/sites/xstyled/deploys/60584152ce7ae70008522e1f I saw that I can configure a custom cache folder using environment variables but I think dependencies caching should work out of the box for common package managers like yarn. |
Hi @gregberge and the Netlify team. We were considering trying out Yarn 2, which was released at the beginning of 2020, but are concerned about how little support Netlify seems to have for it. Wanted to draw your attention to the fact that there's been a few posts to your forums over the last year without any actual movement. One of them claims that adding an extra path configuration file to the repo makes it at least buildable with Yarn 2. https://answers.netlify.com/t/using-the-new-yarn-release-2-0-0-berry/8270 But the issue notes above indicate that there's v1-specific All of these things make our team wary of even trying it out while using Netlify, although we'd like to -- Yarn 2 is a major version of one of the most popular package managers after all. Any progress to report here? Thanks! |
@mosesoak
I was able to verify that this works for one of my projects.
You're probably referring to zero installs here and that is something that is completely optional (see more here). Netlify should probably verify if a project is using zero installs and then don't execute |
Any progress on this? It seems that build plugins installed via |
Another confused user here 😥 I am switching a Yarn 3 project to Netlify, but can’t get cache working no matter what I try. The most rational move I could come up was setting these variables in Netlify UI and then trying to run the deploy twice:
Regardless of what I do, I keep getting:
which means more than two minutes are wasted on every build. I am using Next and my build setup on Netlify is pretty basic:
# netlify.toml
[build]
publish = ".next"
[[plugins]]
package = "@netlify/plugin-nextjs" # .yarnrc.yml
nodeLinker: node-modules
yarnPath: .yarn/releases/yarn-3.1.1.cjs I have even tried setting The oddest thing is this:
Something is being cached somewhere and it’s clearly bigger than Next.js cache (≈50MB). I am giving up after wasting the whole evening 😭 Does anyone have any working solution for Yarn 3? If you do, please share 🙏 |
Hi @kachkaev , We don't use Next, we use React App with Create React App (4.0.3) and the yarn cache is working (but it wasn't easy to find the "rigth" setup) Our netlify.toml:
We have .yarnrc and .yarnrc.yml with the same content:
Our netlify build log:
We are getting this warning, so I don't know how long it will work. I hope this will help you! Ps.: I checked the Netlify build-image repo to find out how the netlify cache works and it helped a lot. |
Thanks a lot for your reply @ZotyoNegentropics – your solution worked! All I had to do in my case was adding these lines to [build]
publish = ".next"
+ ## Yarn 3 cache does not work out of the box as of Jan 2022. Context:
+ ## https://github.com/netlify/build/issues/1535#issuecomment-1021947989
+ [build.environment]
+ YARN_CACHE_FOLDER = "/opt/buildhome/.yarn_cache"
+ YARN_VERSION = "3.1.1"
+
[[plugins]]
package = "@netlify/plugin-nextjs" Here is the result:
🎉 I think I tried both Thanks again – and I hope that Netlify will fix this permanently soon! |
Just tried to set up a new Netlify site with a Netlify Build Plugin defined in |
@ineffyble do you have a reproducible example? (with the plugin inside the |
@lukasholzer Have a look at https://github.com/ineffyble/effy.space/tree/broken - I've just reverted the change in this branch so that you can see the |
@ineffyble I see yarn Plug'n Play is failing for you inside the plugins installation for local plugins: https://app.netlify.com/sites/bespoke-meerkat-b0b937/deploys/6377551993b59a000932e6ba |
@lukasholzer I'm not quite sure what you mean. Yarn is happy, but Netlify believes the plugin isn't installed. |
This happens locally as well for me when running |
Hello @lukasholzer! I just happen to have found this thread and was wondering where are we in the support of Yarn PnP ( and also Corepack)? Also will Netlify support Yarn v4 that landed few month ago? The current documentation says that PnP is not supported (https://docs.netlify.com/configure-builds/manage-dependencies/#yarn) |
@netlify/build
runsyarn
on two instances, which are both opt-in behavior:@netlify/plugin-functions-install-core
plugin is used, we runyarn
in the functions directory@netlify/plugin-local-install-core
plugin is used, we runyarn
in any local plugins directoryIn both cases, we detect
yarn
by looking for the presence of ayarn.lock
. This does not work in many cases, which is why we might want to also check for the presence of aUSE_YARN
environment, as suggested in netlify/build-image#440Also, the command we are running is
yarn install --no-progress --non-interactive --cache-folder=/opt/buildhome/.yarn_cache
. According to netlify/build-image#440, this has few issues:--cache-folder
was replaced with the environment variableYARN_GLOBAL_FOLDER
in Yarn v2--no-progress
and--non-interactive
do not exist anymoreThe text was updated successfully, but these errors were encountered: