If this is an issue in the pipeline make sure in the Azure pipeline you clear the cache so it uses the newly fresh node 16/18 cache.
As most pipelines will cache the old ones to save time your technically trying to build it with 14 though the yarn.lock file etc is set to 16