Update NPM when NVM was installed using chocolatey on Windows

Chocolatey is used frequently to install this kind of utilities but sometimes it could come with problems. NVM is a tool to install different versions of Node.js and it is very useful for developers because it is very simple to work with different versions, but NVM was intended to work for Linux and Mac and NVM for Windows is a different project but it works very well.

The problems come when you use chocolatey to install NVM and then you want to update all your packages or only NPM using npm update -g you will see an error similar to this one:

C:\>npm update -g
npm ERR! path C:\Program Files\nodejs\npx.cmd
npm ERR! code EEXIST
npm ERR! Refusing to delete C:\Program Files\nodejs\npx.cmd: is outside C:\Program Files\nodejs\node_modules\npx and not a link
npm ERR! File exists: C:\Program Files\nodejs\npx.cmd
npm ERR! Move it away, and try again.

The error says that it can't continue because NPM can't overwrite the files that are already in your system, the files that should be overwritten are inside this path %ProgramFiles%\nodejs and the files are these:
npm npm.cmd npx npx.cmd node_modules\npm

So, to fix this problem you need to remove the files manually or use the commands below using the Command Prompt (CMD) as a normal user.

pushd %ProgramFiles%\nodejs
del npm npm.cmd npx npx.cmd
move node_modules\npm node_modules\npm2
call node node_modules\npm2\bin\npm-cli.js i npm@latest -g
rmdir /S /Q node_modules\npm2

If you don't have problems with the previous list of commands you will have the last version of NPM installed on your system and you will be able to update all the packages.