我在创建react native项目时获得-bash: react-native: command not found error分.

以下是其他信息

1. brew --version
   homebrew 0.9.9
2  brew info watchman
   watchman `enter code here`stable 4.50
   /usr/local/Cellar/watchman/4.4.0
3. brew info flow
   stable 0.24.1
   /usr/local/Cellar/flow/0.24.1
4. brew info node
   stable 6.1.0
   /usr/local/Cellar/node/6.1.0
5. npm -version
   3.8.6
6. echo $PATH
/Users/Ashok/.rbenv/shims:/Users/Ashok/.rbenv/shims:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin

我try 了从this link开始的建议步骤,但仍然收到相同的错误.

我没有他们在解决方案中指定的任何"npm"目录

Ashoks-MacBook-Pro:share Ashok$ ls
aclocal     doc     info        ruby-build  zsh
autoconf    emacs       man     systemtap

但是我发现npm文件存在于下面的位置.

/usr/local/Cellar/node/6.1.0/etc/bash_completion.d

我卸载了REACTION-NATIVE,然后重新安装了它,但是我仍然面临同样的问题.

推荐答案

After adding right path to the PATH variable issue is resolved.

Below are the steps to find the right path.

1. Enter: npm install -g react-native-cli
output: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native ->/usr/local/Cellar/node/6.1.0/libexec/npm/lib/node_modules/react-native-cli/index.js/usr/local/Cellar/node/6.1.0/libexec/npm/lib
└── react-native-cli@0.2.0 

from above output you can clearly see the path: /usr/local/Cellar/node/6.1.0/libexec/npm/bin/react-native

export PATH="/usr/local/Cellar/node/6.1.0/libexec/npm/bin:$PATH"

react-native init appName

cd appName

react-native run-ios

if you getting 100 at this stage you can reslove using below steps

XCode -> Preferences -> Locations -> Command Line Tools -> Choose Xcode 7.2.1

你可以从xcrun unable to find simctl个答案中找到原始答案

感谢@fbozo

就是这样!

Ios相关问答推荐

如何在SwiftUI中顺时针和逆时针两个方向应用旋转效果?

SwiftData在获取值时应用程序崩溃:线程1:EXC_BREAKPOINT(代码=1,子代码=0x101e8303c)

带菜单的选取器不适用于Int32,但适用于Int

为什么AVSpeechSynthesizer复制的信息比我的文本多?

iOS Swift 应用程序实例的存活时间

确保方法调配的安全有效实施

部分保留 UITextField 中的占位符

将 URLCache 子类与 URLSession 一起使用

CGPath intersection(_:using:) 和朋友(iOS 16 中的新功能)坏了?

在 SwiftUI 中放置全局 NavigationPath 的位置

SwiftUI - ScrollView 不显示底部文本

如何将 ImageView 放置在 UIView 的中心?

如何告诉 SwiftUI 视图绑定到嵌套的 ObservableObjects

在设备上卸载 ios 应用程序后如何在 ios 中保留 identifierForVendor?

iOS swift从另一个数组中删除一个数组的元素

使用导航控制器在prepareForSegue中设置数据

iOS - 确保在主线程上执行

Select 器touchesBegan:withEvent:的覆盖方法具有不兼容的类型(NSSet,UIEvent)->()

检测应用程序何时进入我的视图背景的最佳方法是什么?

找不到开发者磁盘映像