If you are running Node in Windows Subsystem for Linux then you may come across errors like the following when running yarn or npm install.

EPERM: operation not permitted, copyfile '/home/simon/.cache/yarn/v6/npm-@babel-code-frame-7.10.4-168da1a36e90da68ae8d49c0f1b48c7c6249213a-integrity/node_modules/@babel/code-frame/package.json' -> '/mnt/c/Users/simon/Documents/projects/project/node_modules/@babel/code-frame/package.json'

These errors are likely being triggered because you need to upgrade the version of WSL that you are running. To verify the version you can list the installed distros.

wsl.exe -l -v

You can drop the .exe part of the command if you’re using PowerShell or Command Prompt, but you don’t have to. It is only neccessary when you’re in a WSL bash prompt.

If the distribution you are using has a version of 1 then you can upgrade it - make sure your replace Ubuntu-20.04 with the name of the distribution you’re using.

wsl.exe --set-version Ubuntu-20.04 2

To ensure that any further distributions use WSL2 you can also update the default installation version:

wsl.exe --set-default-version 2

Finally, when you listed the versions (wsl.exe -l -v) you may have noticed there was an asterisk (*) beside one distribution - this indicates that it is the default distribution. You can change this to your preferred distribution (again change the distribution name to match the distribution you are using).

wsl.exe --set-default Ubuntu-20.04