[英]How to perform a clean install of NPM
Every time I try to run npm on Windows 10, I get Error: EINVAL: invalid argument, mkdir 'C:\Program Files\nodejs"'
每次我尝试在 Windows 10 上运行 npm 时,我都会收到
Error: EINVAL: invalid argument, mkdir 'C:\Program Files\nodejs"'
%Appdata%\npm
and %Appdata%\npm-cache
.%Appdata%\npm
和%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. 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.每次我重新启动、重新安装 NodeJS 并尝试使用 NPM 时,我都会收到相同的错误。
When I try to check what version of NPM is actually installed, the answer is... the same error.当我尝试检查实际安装的 NPM 版本时,答案是......同样的错误。
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?如何从 Windows 10 中删除所有与 NodeJS 和 NPM 相关的文件和设置,以便我可以执行实际的全新安装,而无需求助于核选项,格式化驱动器并重新安装 ZAEA23489CE3AA9B64006EBB28E0CDA43
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 .好的,在撕掉我的头发以及我电脑上安装的一半软件之后,我继续谷歌搜索,最终通过调查这个问题中提到的一些文件路径偶然发现了解决方案: nodejs npm global config missing on windows 。
Apparently, there is a config file %userprofile%\.npmrc
which is relevant somehow.显然,有一个配置文件
%userprofile%\.npmrc
以某种方式相关。 On my own computer, this file contained the text prefix=C:\Program Files\nodejs"
.在我自己的计算机上,此文件包含文本
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.
当我清空文件时,npm 又开始工作了,就这样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.