最近React-Native項目中發現一個奇怪的問題:
當執行:
react-native run-ios
的時候,發生如下錯誤:
PCH was compiled with module cache path '/Users/tyler/workspace/html5space/HappyTime/ios/build/ModuleCache/HST39TUTS9TS', but the path is currently '/Users/tyler/workspace/webstormspac/react-native-template/ios/build/ModuleCache/HST39TUTS9TS'
react-native AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
因為這個ios工程我在本地復制粘貼過,也就是說工程位置轉移了,之前是沒有問題的。在新的工程位置執行命令才發生此問題。
探索一番,找到了解決方案:
首先我們在ios工程目錄下找到這個ModuleCache文件夾:
刪除ModuleCache文件夾,然后重新執行:
react-native run-ios
即可成功運行,build success!