After almost 8 years of JS development this is the weirdest thing that happened to me so far.
I have a React project managed with yarn and I depend on a library developed by my company.
I’m using the version 6.0.0 of a library and everything is working fine. The team that mantains this library has released 2 new minors, 6.1.0 and 6.2.0. I want the changes from 6.1 but not the ones from 6.2.0, so in my package.json I changed the dependency in this way:


"my-company/my-dependency": "^6.0.0",


"my-company/my-dependency": "6.1.0",

In this way I’m sure that yarn will install the 6.1.0 version but NOT the 6.2.0, as I removed the carret ^, and in fact in the yarn.lock file i correctly see that he installed 6.1.0.

The problem is that once at runtime I see the stuff from the version 6.2.0, and the weirdest part is that even if I downgrade the dependency to 6.0.0 or even below on my package.json, I still see the 6.2.0‘s stuff at runtime.
Any Chrome cache clear was useless.
The only solution so far has been deleting the repository folder on my mac and re-clone it, then it starts working normally with 6.0.0.
But every time I put 6.1.0, the nightmare is back.

Any help?

▶ yarn --version

▶ node --version