简体   繁体   English

react-native run-ios 需要很长时间才能构建,有时永远不会

[英]react-native run-ios takes forever to build and sometimes never does

I start my app with react-native run-ios and i get left at this portion of the build process, sometimes indefinitely.我使用 react-native run-ios 启动我的应用程序,但有时会无限期地留在构建过程的这一部分。 why does this happen?为什么会这样?

Alexs-MBP:swig_app alexhome$ react-native run-ios Found Xcode project swig_app.xcodeproj Building using "xcodebuild -project swig_app.xcodeproj -configuration Debug -scheme swig_app -destination id=C46C9065-C23A-4118-AB00-5957B64086B1 -derivedDataPath build" User defaults from command line: Alexs-MBP:swig_app alexhome$ react-native run-ios Found Xcode project swig_app.xcodeproj Building using "xcodebuild -project swig_app.xcodeproj -configuration Debug -scheme swig_app -destination id=C46C9065-C23A-4118-AB00-5957B64086B1 -derivedDataPath build " 命令行中的用户默认值:

IDEDerivedDataPathOverride = /Users/alexhome/Desktop/swig_app/ios/build

Ive tried all the usual cleaning commands such as watchman watch-del-all and virtuall ever other cache cleaning command there is.我已经尝试了所有常用的清理命令,例如 watchman watch-del-all 和 virtuall 任何其他缓存清理命令。 sometimes the make it worse tho有时会使情况变得更糟

package.Json:包.json:

{ "name": "swig_app", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "react": "16.6.3", "react-native": "0.57.8", "react-native-router-flux": "^4.0.6", "react-redux": "^6.0.0", "redux": "^4.0.1" }, "devDependencies": { "babel-jest": "23.6.0", "jest": "23.6.0", "metro-react-native-babel-preset": "0.51.1", "react-test-renderer": "16.6.3" }, "jest": { "preset": "react-native" } } { “名称”:“swig_app”,“版本”:“0.0.1”,“私有”:true,“脚本”:{ “开始”:“节点 node_modules/react-native/local-cli/cli.js 开始", "test": "jest" }, "dependencies": { "react": "16.6.3", "react-native": "0.57.8", "react-native-router-flux": "^ 4.0.6”、“react-redux”:“^6.0.0”、“redux”:“^4.0.1”}、“devDependencies”:{“babel-jest”:“23.6.0”、“jest” :“23.6.0”,“metro-react-native-babel-preset”:“0.51.1”,“react-test-renderer”:“16.6.3”},“jest”:{“preset”:“反应原生“}}

I had a similar situation happen to me recently after I deleted the build file in the IOS folder.在我删除 IOS 文件夹中的构建文件后,我最近发生了类似的情况。 I ran react-native run-ios and it was stuck in the same place forever.我运行了 react-native run-ios 并且它永远卡在同一个地方。 I then tried opening the project in Xcode and realized Xcode was not opening the project at all and so react-native could not build the project.然后我尝试在 Xcode 中打开项目并意识到 Xcode 根本没有打开项目,因此 react-native 无法构建项目。 I restarted my computer, tried opening the project again in Xcode and when that worked, I closed it and ran react-native run-ios and everything went back to normal.我重新启动计算机,尝试在 Xcode 中再次打开项目,当它成功时,我关闭它并运行 react-native run-ios,一切恢复正常。

运行killall -9 node以终止所有节点进程。

I start my app with react-native run-ios and i get left at this portion of the build process, sometimes indefinitely.我使用 react-native run-ios 启动我的应用程序,然后我会留在构建过程的这一部分,有时是无限期的。 why does this happen?为什么会这样?

Alexs-MBP:swig_app alexhome$ react-native run-ios Found Xcode project swig_app.xcodeproj Building using "xcodebuild -project swig_app.xcodeproj -configuration Debug -scheme swig_app -destination id=C46C9065-C23A-4118-AB00-5957B64086B1 -derivedDataPath build" User defaults from command line: Alexs-MBP:swig_app alexhome$ react-native run-ios Found Xcode project swig_app.xcodeproj Building using "xcodebuild -project swig_app.xcodeproj -configuration Debug -scheme swig_app -destination id=C46C9065-C23A-4118-AB0165-derivative " 来自命令行的用户默认值:

IDEDerivedDataPathOverride = /Users/alexhome/Desktop/swig_app/ios/build

Ive tried all the usual cleaning commands such as watchman watch-del-all and virtuall ever other cache cleaning command there is.我已经尝试了所有常用的清理命令,例如 watchman watch-del-all 和 virtuall 其他缓存清理命令。 sometimes the make it worse tho有时会使情况变得更糟

package.Json:包.Json:

{ "name": "swig_app", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start", "test": "jest" }, "dependencies": { "react": "16.6.3", "react-native": "0.57.8", "react-native-router-flux": "^4.0.6", "react-redux": "^6.0.0", "redux": "^4.0.1" }, "devDependencies": { "babel-jest": "23.6.0", "jest": "23.6.0", "metro-react-native-babel-preset": "0.51.1", "react-test-renderer": "16.6.3" }, "jest": { "preset": "react-native" } } { "name": "swig_app", "version": "0.0.1", "private": true, "scripts": { "start": "node node_modules/react-native/local-cli/cli.js start ", "test": "jest" }, "dependencies": { "react": "16.6.3", "react-native": "0.57.8", "react-native-router-flux": "^ 4.0.6", "react-redux": "^6.0.0", "redux": "^4.0.1" }, "devDependencies": { "babel-jest": "23.6.0", "jest" : "23.6.0", "metro-react-native-babel-preset": "0.51.1", "react-test-renderer": "16.6.3" }, "jest": { "preset": "反应原生" } }

This usually happens on first build, so simple resolution is to quit the running process and then delete the ios/build directory after that rerun the command "react-native run-ios" again.这通常发生在第一次构建时,因此简单的解决方法是退出正在运行的进程,然后删除 ios/build 目录,然后再次运行命令“react-native run-ios”。

For more information refer to this thread有关更多信息,请参阅此线程

https://github.com/facebook/react-native/issues/24815 https://github.com/facebook/react-native/issues/24815

May be this helps you or somebody else, Thanks!可能对您或其他人有帮助,谢谢!

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

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