【问题标题】:npx create-react-app myApp does not work _npx\10796" as it does not contain a package.json filenpx create-react-app myApp 不起作用 _npx\10796" 因为它不包含 package.json 文件
【发布时间】:2020-04-25 01:42:15
【问题描述】:

我正在尝试为 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.js reactjs npm


    【解决方案1】:

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

    运行:

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

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

    【讨论】:

      【解决方案2】:

      检查全局位置中的空间 - 如果路径中有空间,npx 会出错。

      运行:

      • npm install create-react-app --(本地)
      • npx create-react-app newapp

      谢谢

      【讨论】:

        猜你喜欢
        • 2021-01-06
        • 1970-01-01
        • 2021-09-11
        • 2020-06-29
        • 1970-01-01
        • 2021-03-05
        • 1970-01-01
        • 2021-06-09
        • 1970-01-01
        相关资源
        最近更新 更多