react-native启动开发常见错误(持续更新)

react-native启动开发常见错误(持续更新)

1. debug error: make directory ... File exists
error: make directory /Users/mobilewise/Library/Developer/Xcode/DerivedData/MCDM-epoyegaizqaljifbmfuxvovvwxqn/Build/Products/Debug-iphoneos/MCDM_guangzhoudianwang.app/mapapi.bundle/images: File exists
error: couldn't remove '/Users/mobilewise/Library/Developer/Xcode/DerivedData/MCDM-epoyegaizqaljifbmfuxvovvwxqn/Build/Products/Debug-iphoneos/MCDM_guangzhoudianwang.app/mapapi.bundle' after command failed: Directory not empty

解决方案:
`Build Phases--->>Copy Bundle Resources,
删除多余的文件即可 .`, 类似的缺少打包后存放目录的文件件等, 新建文件夹即可。

2. iOS开发 Build operation failed without specifying any errors 问题fix

xcode报错如下:

verify final result code for completed build operation
Build operation failed without specifying any errors. Individual build tasks may have failed for unknown reasons.
One possible cause is if there are too many (possibly zombie) processes; in this case, rebooting may fix the problem.
Some individual build task failures (up to 12) may be listed below.

解决方案如下:
是由于cocoapods版本导致, 重新安装即可:

//删除1.4.0包
sudo gem uninstall cocoapods -v 1.4.0

//然后安装指定版本的Cocoapods
sudo gem install cocoapods -v 1.3.1

//检查版本
pod --version

参考文章-掘金

3. 项目地址改变后出现问题

Argument list too long: recursive header expansion failed at
解决方案:Build Settings -> User Header Search Paths 删除其中内容

4. 安卓打包报错

':app:bundleReleaseJsAndAssets FAILED'
解决方案: ./gradlew assembleRelease -x bundleReleaseJsAndAssets

5. 安卓打包报错

Execution failed for task ':app:transformClassesAndResourcesWithProguardForRelease
解决方案:add the below to your ProGuard rules
`
-ignorewarnings

-keep class * {

public private *;

}
`
https://stackoverflow.com/que...

6. 安卓模拟器debbuger报错

CORS issue with JS Remote Debugging when using xip.io
解决办法https://github.com/facebook/react-native/issues/17618

7. 安卓webview无法返回数据

react native android webview onmessage not working
解决方案:

// 方案1
if (window.postMessage.length !== 1) {
  window.postMessage = function(msg) {
    setTimeout(function () {
      console.log('window.postMessage not ready')
      window.postMessage(msg);
    }, 500);
  }
}
// 方案2
function waitForBridge() {

   //the react native postMessage has only 1 parameter
   //while the default one has 2, so check the signature
   //of the function

   if (window.postMessage.length !== 1){
     setTimeout(waitForBridge, 200);
   }
   else {
     window.postMessage('abc');
   }
}

window.onload = waitForBridge;

参考

https://github.com/facebook/r...
https://stackoverflow.com/que...
8. Xcode 10 的一些错误
错误:third-party: 'config.h' file not found

https://github.com/facebook/r...

错误:'config.h' file not found

https://github.com/facebook/r...

错误: libfishhook.a cannot be found

https://github.com/facebook/r...

错误: `React/RCTBridgeModule.h file not found`

https://stackoverflow.com/que...

9. iOS编译报错duplicate symbol _OBJC_CLASS_$_RCTFrameAnimation

dfile:
图片描述
图片描述
参考:
https://github.com/auth0/reac...

10. ios启动报错

The request was denied by service delegate (SBMainWorkspace) for reason: Security ("Entitlement "com.apple.frontboard.debugapplications" required to launch applications for debugging").
解决方案:
删除以下文件夹所有内容:/Users/xx/资源库/Developer/CoreSimulator/Devices/
参考: https://www.jianshu.com/p/133...

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值