Builds failing because they started using npm instead of yarn

Hi, builds for some of my client’s websites have starting failing without any change on my part in the code or anywhere else.
This is because for some reason Netlify started using NPM instead of Yarn to install the dependencies, and NPM is stricter with the peer dependencies.

These are the two websites where I’ve noticed this (they share the same codebase):

Here you can see a successful and failing builds:

and see how they only differ in that the successful one says:
“Installing NPM modules using Yarn version 1.22.4”
and the failing one says:
“Installing NPM modules using NPM version 8.19.2”

Can you help me?

1 Like

Same error here across two of our sites.

Here is the relevant error message from the Netlify build logs:

9:35:50 AM: The package manager we have detected () through a lock file or the `packageManager` property inside your `package.json`, does not align with the environment variable NETLIFY_USE_YARN=true you have specified!

@zachwe I didn’t have that error, so I tried using NETLIFY_USE_YARN = "true" in my netlify.toml and "packageManager": "yarn@1.22.19", in my package.json but all I managed was to start getting that error, still no build… :smiling_face_with_tear:

Hey folks! Thanks so much for reaching out. We have looped in the appropriate teams to investigate this. I will follow up once we have more information.

we are also experiencing the same issue. neither of the solutions you tried work for us either :frowning:

Hey folks,

Just reverted the change that we think caused the problem. Please let me know if new builds work better or not!

1 Like

Yes it did, thank you very much for the prompt fix!