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):
ascenza-es-r44mjt34
ascenza-br-kmnw3t3m

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!

This started happening to my Netlify sites two days ago. It’s set up to use Yarn and randomly started using NPM and getting this error. Did it stop happening to everyone on this thread? Did yall do anything to fix it?

1 Like

I can confirm I’m experience the same issue @huddlehouse is.

@fool Do you know if the fix was implemented?

This is still happening on all my Netlify sites.

We need to see the sites you all :slight_smile: please share the site names

Same issue; started happening today.

  • Here’s the failing build: Netlify App
  • Site name: 3perf-preview
  • Diff between the working build log (several days ago) and a failing one (today); one notable difference is the buildbot version: build.diff · GitHub
  • Setting NETLIFY_USE_YARN=true or clearing the caches doesn’t help

We had the opposite issue, we have Netlify set to use NPM, but it started using Yarn instead, even with NETLIFY_USE_YARN set to false.
Site: Netlify App
We have a monorepo using yarn workspaces, but were using npm to build the Netlify app because there were issues using yarn in Netlify.

@hrishikesh This problem started happening to me again (Installing NPM modules using NPM version 6.14.4 on a Yarn project), only noticed on one website so far: pelaterra-landingpage-site-x77vx3gx, build 638e6b6d7df82d09fcac01d7.

This doesn’t break the build due to peer dependencies this time, but does break because later it tries to run yarn build and cannot find yarn.

This started happening to me today as well and I made no code changes. I thought it was due to the Github issue that was reported earlier (Netlify Status - Failure of Some GitHub-triggered Builds), but that has been resolved and my site builds are still failing after attempting to install dependencies with NPM.

Another new error I’m noticing in the logs is “Failed to get framework information, continuing with build”. After this point, it attempts to install dependencies with NPM instead of Yarn.

4 Likes

This also is happening to me. Once in awhile it builds but breaks again.

1 Like

I’m also seeing this currently and can’t build my sites. e.g. youthful-hawking-098c6b hasn’t changed and used to build via yarn but now the builds always try to use npm to install dependencies.

Built with yarn: Netlify App
Deploying the same commit tries to use npm now: Netlify App

Also seeing with jolly-visvesvaraya-e22de2 and tried making a new site charming-kataifi-c3dc05 which still had the same issue

2 Likes

glowing-brioche-207e55.netlify.app

Hi !

I can see that I am not alone in experiencing a switch in the way my code is built ! I too have tried setting NETLIFY_USE_YARN en var to no effect.
My site id is db3d8264-8365-4736-bc8d-52fea969fe91

Hoping it will help fix the problem

Thanks a ton
Alex

Hey I’m already working on this issue it seems that the framework detection is failing.

Failed during stage 'Detect user site framework': @netlify/build-info failed: TypeError: Cannot read properties of undefined (reading 'version')\n    at getFrameworkVersion (file:///opt/buildhome/node-deps/node_modules/@netlify/framework-info/src/main.js:72:28)

Which is then crashing our package manager detection and therefore we fallback always to NPM. Will try to push the fix out today.

3 Likes