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
[build-utils] Fix Yarn 2 install argument order #4444
Conversation
Fix for Yarn Version 2. Positioned the arguments array in proper order
@@ -291,7 +291,7 @@ export async function runNpmInstall( | |||
} else { | |||
opts.prettyCommand = 'yarn install'; | |||
command = 'yarn'; | |||
commandArgs = args.concat(['install', '--ignore-engines']); | |||
commandArgs = ['install', ...args, '--ignore-engines']; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! Please add a test fixture under now-build-utils/test/fixtures
so we can see what this is fixing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So from what I understand I have to add a sample project with yarn 2 there right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, you would add a project that would fail with the current behavior but is fixed with your change to the arguments.
I'm guessing you have yarn 2 as a dev dependency?
The original description doesn't explain how to reproduce the error or what the error says.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update: I just saw #4436.
You can add the code from your repo as a test fixture.
But it doesn't install yarn 2?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@styfle Yarn 2 works in an interesting way.
The version that's installed is actually yarn 1.22 (usually this is installed globally not as a dev dependency), but you set it to use Yarn 2 in the project level by running the command yarn set version berry
which then sets up that project to use the latest yarn version.
I think it should still be reproducible in a sample project I think, due to yarn installing Yarn 2 in the .yarn folder.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes @MarkLyck is kinda right, globally any version can be installed, but then you can also have an another local version installed in the .yarn
folder and point to it through the .yarnrc
(in case of v2 .yarnrc.yml
) file. This behavior is not specific to yarn v2, you can try doing yarn set version latest
in an non v2 project too.
Thus, generally, projects using v2 have it installed locally, with the help of yarn set version berry
.
And Alright will be spinning up the default demo project with yarn v2!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@styfle Added a Template Svelte project with yarn v2
How this PR is going, guys? I really need it. Anything I can help? I see some checks are failing. |
Most of the tests are failing because of being a 3rd Party PR. Although not sure about why |
Can someone look into this? It is a fairly small PR, should not take more than 20 Minutes. The Fixture is the default template project too. |
I ran the test locally and it is not passing.
We need to add a |
When I added {
"version": 2,
"builds": [
{ "src": "package.json", "use": "@vercel/static-build" }
],
"probes": [
{ "path": "/", "mustContain": "Svelte app" }
]
} I get an error:
Is Update: This too needed to move the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks! 🎉
I still seem to get the same error, is the master branch deployed? |
Follow up to #4444 that makes sure we run Next.js tests. This `--ignore-engines` flag was originally added in vercel/now-builders#463 as a workaround. We can remove it to make sure the version of Node selected will work with the dependencies. Removing the flag also makes sure that Yarn 2 will work properly, see #4444.
When will this get deployed to Vercel production, guys? |
This change is available on the canary channel |
@styfle when will it be deployed to production? I solely use the GitHub app to deploy our sites, I don't think there's any way I can point that to canary? |
It will be available in the next stable release in a few weeks or so |
@styfle Is there a way we could use canary builds during build process or deployments? |
Git deployments don't have a way to opt-in to canary builds yet but we will add a flag in the future |
@styfle Is there any other way to deploy? Other than git deployments? |
Yes with Vercel CLI. See my previous comment #4444 (comment) |
Fix for Yarn Version 2 install error. Positioned the arguments array in proper order #4436