首页 > 解决方案 > npx create-react-app myApp 不起作用 _npx\10796" 因为它不包含 package.json 文件

问题描述

我正在尝试为 React 设置我的环境,但是当我尝试运行该命令时,npx create-react-app myApp我收到以下错误:

1) npm ERR! code ENOLOCAL

2) npm ERR! Could not install from "Guillen\AppData\Roaming\npm-cache\_npx\10796" as it does not contain a package.json file.

3) npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Andres Guillen\AppData\Roaming\npm-cache\_logs\2020-04-25T01_16_30_068Z-debug.log

La instalación de [ 'create-react-app@latest' ] fracasó con código 1.
I have this node js version : 13.2.0 , npm version: 6.13.1

我不知道如何解决这些错误,有什么想法吗?提前致谢。

标签: node.jsreactjsnpm

解决方案


PC 名称“Andres Guillen”中有一个空格字符会导致问题。

跑:

  • npm config set cache "C:\Users\ALEXAN~1\AppData\Roaming\npm-cache" --global
  • npx create-react-app newapp

忽略空格字符是一种解决方法。


推荐阅读