【问题标题】:Error with React Native when trying to start App尝试启动 App 时 React Native 出错
【发布时间】:2020-08-26 08:02:23
【问题描述】:

我正在按照Documentation 中提供的步骤为 React Native 设置环境。 我已经安装了 create-react-native-appexpo-cli 。 此外,我还使用expo init 创建了一个应用程序。

现在,当我尝试使用 yarn startnpm start 运行应用程序时,出现以下错误:

Error: spawn powershell ENOENT
    at Process.ChildProcess._handle.onexit (internal/child_process.js:240:19)
    at onErrorNT (internal/child_process.js:415:16)
    at process._tickCallback (internal/process/next_tick.js:63:19)
error Command failed with exit code 1.

我该如何解决?这与powershell有关吗? (但我也在命令提示符中得到它)

附:我正在使用 Windows 8、Expo 3.24.2、yarn 1.22.4、节点 10.15.3

【问题讨论】:

标签: react-native npm expo yarnpkg


【解决方案1】:

我在运行 yarn start 时也遇到了同样的错误。 要解决此问题:转到

  1. 控制面板 -> 系统和安全 -> 系统 -> 高级系统设置 -> 环境变量。
  2. 在用户变量 -> 变量路径 -> 添加新路径,即 (C:\Windows\System32\WindowsPowerShell\v1.0)
  3. 然后单击确定并关闭控制面板。
  4. 现在打开 Windows Powersell 并写入: Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
  5. 点击进入并关闭powershell
  6. 重新打开 cmd 并输入 yarn start 或 npm start

错误消失了 :)

【讨论】:

    猜你喜欢
    • 2019-12-24
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-05-29
    • 2018-04-19
    • 2019-03-09
    • 2019-05-28
    • 2021-07-20
    相关资源
    最近更新 更多