2. 执行 npx create-react-app my-app 创建一个 react 项目。
3. cd my-app
4. npm start
问题:在创建 npm create-react-app my-app 时,报错:
npm ERR! Could not install from "Files\nodejs\node_cache\_npx\13472" as it does
not contain a package.json file.
原因:因为 node_cache 路径中有空格。
执行: npm config get cache
结果为: D:\Program Files\nodejs\node_cache
路径中有空格。
解决: npm config set cache "D:\Program~1\nodejs\node_modules\npm\node_cache"--global
即可。