I have figured out a solution, if you’re using nvm
make sure you don’t have another globally installed version of Node/npm.
If you aren’t sure whether or not you have a global version, go to your bash_profile/zshrc and comment the three nvm
initialization lines (export NVM_DIR="$HOME/.nvm" [...]
), then open a new terminal and do node --version
, if it still finds something it means that you have a global version somewhere, and you can find its path with which node
.
In my case I’m using Homebrew, and I had a global version of Node that I wasn’t even aware coming from the yarn
formula, I discovered it after running brew uses --installed node
. I went ahead and uninstalled yarn using brew uninstall --force yarn
, which automatically uninstalled its node/npm dependency, then uncommented the nvm
initialization lines, and then I reinstalled yarn
using nvm’s npm with npm i -g yarn
, and now everything works.