I encountered this problem when installing the vue environment today, and finally solved it after a lot of hard work.
Here are the solution steps:
reason:
The reason for this problem: When setting global variables and cache, due to a setting error, the system cannot create a new folder when executing the npm command!
step:
1. Just go to the C drive and modify the .npmrc file. I cleared the global and cache variables.
2.cmd executes "npm -v" and it shows success
Hereby share and record, the program is as deep as the sea, everyone can help each other and win-win! Thanks