xcode react-native run-ios 不起作用

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44131862/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-15 09:59:52  来源:igfitidea点击:

react-native run-ios is not working

iosxcodereact-nativenpm-install

提问by Hazem Hagrass

I have a react native ios and it was working fine, suddnly it's working only in Xcode but not in terminal using this command:

我有一个 react native ios,它工作正常,突然它只能在 Xcode 中工作,但不能在终端中使用以下命令:

react-native run-ios
react-native run-ios --device

Both of command are not working in the root directory, I tried to delete node_modules folder then run:

这两个命令都在根目录中不起作用,我尝试删除 node_modules 文件夹然后运行:

npm install; react-native link;

Unfortunatly it's not working, here are my logs:

不幸的是它不起作用,这是我的日志:

enter image description hereenter image description hereenter image description here

在此处输入图片说明在此处输入图片说明在此处输入图片说明

Any Help!

任何帮助!

回答by Ahmed Lotfy

Seems that you have a lot of missing libraries which are not downloaded for some reason, I recommend that you should delete all downloadable libs then start over again:

似乎你有很多由于某种原因没有下载的丢失的库,我建议你应该删除所有可下载的库然后重新开始:

  • delete node_modules/folder
    • delete ios/Podsfolder
    • delete ios/buildfolder
    • run: npm install
  • run: cd ios; pod install; cd../
  • run: react-native link
  • 删除node_modules/文件夹
    • 删除ios/Pods文件夹
    • 删除ios/build文件夹
    • 跑: npm install
  • 跑: cd ios; pod install; cd../
  • 跑: react-native link

That's it

就是这样

回答by Firda Sahidi

I was able to solve it by upgrading node.

我能够通过升级节点来解决它。

brew upgrade node

type this in terminal.

在终端输入这个。

回答by Arunkumar

I was able to get it working using the instructions here facebook/watchman#376 :

我能够使用这里的说明 facebook/watchman#376 让它工作:

sudo launchctl unload -F ~root/Library/LaunchAgents/com.github.facebook.watchman.plist

Don't know enough about watchman to understand why it was running as a service. But it worked anyway.

对 watchman 了解不够,无法理解为什么它作为服务运行。但无论如何它都奏效了。

or

或者

Uninstalling and reinstalling Watchman fixed this issue for me.

卸载并重新安装 Watchman 为我解决了这个问题。