Yesterday, yarn worked just fine, but today yarn absolutely refuses to work. Running any kind of yarn command fails.
Internal Error: EPERM: operation not permitted, rename 'C:\Users\NAME\.node\corepack\corepack-4304-ea1e7c84.0eb04' -> 'C:\Users\NAME\.node\corepack\yarn\3.1.1'
I tried following the instructions.
I also noticed that the referenced .node folder was read-only. This is weird because every time I try to use yarn, the corepack-RANDOMSTRING is a new folder.
Removing read-only from the folder and checking if it has been removed says it is read only again.
Make sure you are running the CMD prompt as Administrator
Then install Yarn
npm install --global yarn
Verify that Yarn installed correctly
yarn --version
It should print the version number.
Reading through this article https://github.com/yarnpkg/yarn/issues/992 It looks like there are many reasons why this could occur.