【问题标题】:React-Native install on Windows Machine not finding $PATH在 Windows 机器上安装 React-Native 找不到 $PATH
【发布时间】:2019-10-12 12:23:45
【问题描述】:

我先安装 react-native y 安装 react-native-cli

根据以下说明:https://facebook.github.io/react-native/docs/getting-started.html...

我安装了 Android Studio,然后将 sdk 路径添加到我的 $PATH 中,所以如果我 echo $PATH,路径

/c/Users/MyUser/AppData/Local/Android/Sdk/platform-tools

包括在内。那我……

npm install -g react-native-cli

导致

C:\Users\MyUser\AppData\Roaming\npm\react-native -> 
C:\Users\MyUser\AppData\Roaming\npm\node_modules\react-native-cli\index.js
+ react-native-cli@2.0.1
updated 1 package in 2.303s

但它仍然没有找到 react-native ...

react-native-cli --version
bash: react-native-cli: command not found

为什么我找不到我的 react-native-install?

【问题讨论】:

  • 如果您使用的是 Windows,为什么您的路径以 /c/ 开头?不应该是`C:\`吗?
  • 我从 echo $PATH 的输出中复制了该部分。如果我从 Android Studio 系统设置中复制它,它会显示为:C:\Users\MyUser\AppData\Local\Android\Sdk
  • 可以肯定的是,安装后您已经重新启动了吗?

标签: android windows react-native npm


【解决方案1】:

react-native-cli 不是命令。有了这个 npm i -g react-native-cli 你可以使用命令 -> react-native 你现在可以使用 react-native init "project" 然后 npm 开始

【讨论】:

  • 输入 react-native --version 输出:bash: react-native: command not found
  • hummm 开个新词试试
  • 试过了,结果一样:bash: react-native: command not found
  • 或尝试安装 git for windows 并使用(安装后)left clic 和“git bash here”
  • 我已经在使用 Git Bash 作为我的 shell,所以安装了 Git for Windows
猜你喜欢
  • 2022-09-29
  • 2017-01-02
  • 1970-01-01
  • 1970-01-01
  • 2019-02-21
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2016-04-17
相关资源
最近更新 更多