# 報錯了
```
E:\Code\test>npx create-react-app my-react-app
npm ERR! code ENOLOCAL
npm ERR! Could not install from "Files\npm-cache\_npx\7920" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! E:\Program Files\npm-cache\_logs\2020-06-17T10_04_16_773Z-debug.log
Install for [ 'create-react-app@latest' ] failed with code 1
```
# 分析
通過路徑可以推斷,預期路徑應該是"E:\Program Files\npm-cache"。這個路徑中包含一個空格,應該是引發程序錯誤的原因。
通過`npm config get cache` 查看 npm 的 cache 路徑設置,確實是`E:\Program Files\npm-cache`
# 規避
編輯路徑,在不改變路徑的情況下也能辦到。
1、npm config edit
2、將帶空格的路徑改寫為:E:\Progra~1\npm-cache (這是 windows 的一種路徑表達方式)