Could not install from “Files\nodejs\node_modules\npm\node_cache\_npx\14564“ as it does not contain

项目场景:

   npx 执行报错node


问题描述:

 学习react时npx执行报错react

 

npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\nodejs\node_modules\npm\node_cache\_npx\14564" as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
32Z-debug.log

缘由分析:

在网上看了好几个分析,说是node路径带有空格npm

执行 npm config get cachejson

获得  D:\Program Files\nodejs\node_modules\npm\node_cachewindows

看到确实是program files 之间有空格学习


解决方案:

执行:npm config editthis

将带空格的路径改写为:D:\Program~1\nodejs\node_modules\npm\node_cache (这是 windows 的一种路径表达方式)spa

或者直接执行debug

 npm config set cache "D:\Program~1\nodejs\node_modules\npm\node_cache"--globalcode

相关文章
相关标签/搜索