【问题标题】:Create-react-app don't run even just after create itCreate-react-app 即使在创建之后也不会运行
【发布时间】:2020-04-16 10:38:32
【问题描述】:

*npm 错误!代码生命周期

npm 错误!错误号 1

npm 错误! github@0.1.0 start: react-scripts 开始

npm 错误!退出状态 1

npm 错误!

npm 错误!在 github@0.1.0 启动脚本失败。

npm 错误!这可能不是 npm 的问题。有可能 上面的附加日志输出。

npm 错误!此运行的完整日志可在以下位置找到:*

或者有时我只是在创建应用程序后出现不同类型的错误。这意味着对默认自动生成的项目没有任何修改。

【问题讨论】:

    标签: reactjs npm create-react-app


    【解决方案1】:

    我设法解决了。

    问题似乎出在我的 Yarn 上。不完整的卸载或类似的东西。无法通过重新安装 Yarn 或再次卸载它来解决它。正因为如此,NPM create-react-app 也会产生 bug,这 IDK 怎么做。

    但解决方案很棒,我只是在不同的文件夹中创建了项目。相信我,我没有说谎,不同的位置在 NPM 中确实有效。所以我相信我需要格式化我的电脑才能100%解决这个问题。

    原因可能是我通过 NPM 全局安装了 create-react-app 并尝试安装 Yarn create-react-app。无论如何,通过使用不同的文件夹位置,我的问题完全解决了。

    格式化计算机不是解决这个问题的方法。

    【讨论】:

    • 是的,当然,但有时在 Windows 上未授予权限时也会出现此问题。所以解决方案将以管理员身份运行 CMD。
    【解决方案2】:

    这个错误说明你可能是通过npm install -g create-react-app安装的 这是旧版本。

    我认为您需要使用npx create-react-app再次卸载并安装

    步骤

    1 - npm uninstall -g create-react-app

    yarn uninstall -g create-react-app
    

    2 - npx create-react-app my-app

    npx 带有 npm 5.2+ 及更高版本,请参阅旧版 npm 的说明 版本。

    检查这个create-react-app latest one

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2017-12-05
      • 2020-06-23
      • 2020-06-12
      • 1970-01-01
      • 2019-07-03
      相关资源
      最近更新 更多