Every time I try to run npm on Windows 10, I get Error: EINVAL: invalid argument, mkdir 'C:\Program Files\nodejs"'
%Appdata%\npm
and %Appdata%\npm-cache
.c:\program files\nodejs
, checked that c:\program files (x86)\nodejs
does not exist, and tried to install NodeJS in c:\nodejs
instead to get rid of the space in the directory name. Every time I reboot, reinstall NodeJS, and try to use NPM, I get the same error.
When I try to check what version of NPM is actually installed, the answer is... the same error.
How do I eradicate all NodeJS and NPM related files and settings from Windows 10 so that I can perform an actual clean install, without having to resort to the nuclear option, formatting the drive and reinstalling Windows?
Ok, after ripping my hair out, as well as half of the installed software on my PC, I continued googling, and eventually stumbled on the solution by investigating some file paths mentioned in this question: nodejs npm global config missing on windows .
Apparently, there is a config file %userprofile%\.npmrc
which is relevant somehow. On my own computer, this file contained the text prefix=C:\Program Files\nodejs"
.
If that looks familiar, it's because it's the string in the error message that has been plaguing me. When I emptied the file, npm started working again, just like that.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.