简体   繁体   English

`react-native run-ios`命令失败(PCH问题),但是在xcode中构建成功

[英]`react-native run-ios` command fails (PCH issues), but build succeeds in xcode

I had a react native project that was building and running perfectly fine. 我有一个React Native项目,可以很好地构建和运行它。 Then I decided to move it into a sub directory, and I started receiving lots of precompiled header errors: 然后,我决定将其移动到子目录中,并开始收到许多预编译的标头错误:

PCH was compiled with module cache path '/Users/me/place1/ios/build/ModuleCache/3R9LOJFOBFZVJ', but the path is currently
  '/Users/me/place2/app/ios/build/ModuleCache/3R9LOJFOBFZVJ'

Fair enough, but what's weird is that, if I open up the xcode project and clean / rebuild in there, everything works! 足够公平,但是奇怪的是,如果我打开xcode项目并在那里清理/重建,一切正常!

Then when I close down the server started by xcode and try to launch it using react-native run-ios it continues to complain about PCH issues. 然后,当我关闭由xcode启动的服务器并尝试使用react-native run-ios启动它时,它继续抱怨PCH问题。

Not sure what I'm missing... 不知道我在想什么...

Sorry to answer my own, but turns out it's safe to just delete the whole build directory at /path/to/project/ios/build . 很抱歉回答我自己的问题,但事实证明,删除/path/to/project/ios/build的整个构建目录是安全的。 After that it rebuilt fine for me :) 在那之后,它对我来说很好:)

无需删除整个构建目录,只需删除/path/to/project/ios/build/ModuleCache ModuleCache文件夹,然后react-native run-ios进行操作即可。

您必须删除派生数据文件夹。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM