npm Windows机器上的React-Native安装找不到$PATH

xt0899hw  于 2023-05-18  发布在  Windows
关注(0)|答案(2)|浏览(206)

I'm installing react-native first安装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?

wb1gzix0

wb1gzix01#

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

jexiocij

jexiocij2#

Install Chocolatey Chocolatey is a popular package manager for Windows. So at first, we need to install it on our system.

To install Chocolaty, Open Command Prompt with administrator privileges and run the command below.

@"%SystemRoot%\System32\WindowsPowerShell\v1.0\powershell.exe" -NoProfile -InputFormat None -ExecutionPolicy Bypass -Command "[System.Net.ServicePointManager]::SecurityProtocol = 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))" && SET "PATH=%PATH%;%ALLUSERSPROFILE%\chocolatey\bin"

choco install -y nodejs.install python2 jdk8.

npm install –g react-native-cli

More Detail Follow this
https://www.techomoro.com/how-to-install-and-setup-react-native-on-windows-10/

相关问题