I was trying to install two new packages in a big project with multiple sub-projects and the YARN was not able to find the packages even having the .npmrc in the root directory.
Using the
yarn install --verbose
recommended in this thread https://github.com/yarnpkg/yarn/issues/6029 I identified that copying the .npmrc to the root of sub-project could help, and this solved the problem, now the "yarn add" and "yarn install" is working properly.