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”
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…
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.
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?
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.
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
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
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.