原因分析:node路径带有空格
执行
npm config get cache
得到 D:\Program Files\nodejs\node_modules\npm\node_cache
看到确实是program files 之间有空格
解决方案:
执行:npm config edit
将带空格的路径改写为:D:\Program~1\nodejs\node_modules\npm\node_cache (这是 windows 的一种路径表达方式)
或者直接执行
npm config set cache "D:\Program~1\nodejs\node_modules\npm\node_cache"--global
转自:https://blog.youkuaiyun.com/hellobbw/article/details/108402959
本文介绍了解决Node.js中npm配置路径包含空格的问题。通过修改npm缓存路径,使用Windows兼容的路径表达方式,成功解决了由路径中空格导致的错误。


被折叠的 条评论
为什么被折叠?



