Those are literally equivalent though, anything you can install using yarn you can install using npm. They connect to the same registry and use the same package.json format.
Also, pip is relatively recent. Before that, it was a mix of setuptools, easy_install and various manual procedures.