解决升级到Xcode10,react native项目运行报错问题

时间:2024-04-06 07:39:58

今天刚升级到Xcode10,就遇到两个报错问题

错误一:Xcode 10: Build input file double-conversion cannot be found

error: Build input file cannot be found: '../node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'

configure: error: in `../node_modules/react-native/third-party/glog-0.3.4'

react-native run-ios
Found Xcode project awesome.xcodeproj
Launching iPhone 6 (iOS 12.0)...
Building using "xcodebuild -project awesome.xcodeproj -configuration Debug -scheme awesome -destination id=F0EA48DA-E7A0-4E8F-92B3-3D4A2AA93B76 -derivedDataPath build"
▸ Copying /Users/rod/dev/react/testing/awesome/node_modules/react-native/ReactCommon/yoga/yoga/Yoga.h
▸ Copying /Users/rod/dev/react/testing/awesome/node_modules/react-native/ReactCommon/yoga/yoga/YGEnums.h
▸ Copying /Users/rod/dev/react/testing/awesome/node_modules/react-native/ReactCommon/yoga/yoga/YGMacros.h
▸ Compiling YGStyle.cpp
▸ Compiling YGLayout.cpp
▸ Compiling Yoga.cpp
▸ Compiling YGNode.cpp
▸ Compiling YGNodePrint.cpp
▸ Compiling YGFloatOptional.cpp
▸ Compiling YGEnums.cpp
▸ Compiling Utils.cpp
▸ Analyzing Yoga.cpp
▸ Analyzing YGStyle.cpp
▸ Analyzing YGNodePrint.cpp
▸ Analyzing YGNode.cpp
▸ Analyzing YGLayout.cpp
▸ Analyzing YGFloatOptional.cpp
▸ Analyzing YGEnums.cpp
▸ Analyzing Utils.cpp
▸ Building library libyoga.a
▸ Copying /Users/rod/dev/react/testing/awesome/node_modules/react-native/ReactCommon/jsinspector/InspectorInterfaces.h
▸ Compiling InspectorInterfaces.cpp
▸ Analyzing InspectorInterfaces.cpp
▸ Building library libjsinspector.a
▸ Copying /Users/rod/dev/react/testing/awesome/node_modules/react-native/ReactCommon/privatedata/PrivateDataBase.h
▸ Compiling PrivateDataBase.cpp
▸ Analyzing PrivateDataBase.cpp
▸ Building library libprivatedata.a
▸ Running script 'Install Third Party'
▸ Compiling strtod.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc'


▸ Compiling fast-dtoa.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc'


▸ Compiling fixed-dtoa.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc'


▸ Compiling double-conversion.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/double-conversion.cc'


▸ Compiling diy-fp.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/diy-fp.cc'


▸ Compiling cached-powers.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc'


▸ Compiling bignum.cc

❌  error: Build input file cannot be found: '/Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum.cc'


** BUILD FAILED **


The following build commands failed:
	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/strtod.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/strtod.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler

	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fast-dtoa.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/fast-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/fixed-dtoa.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/fixed-dtoa.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/double-conversion.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/double-conversion.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/diy-fp.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/diy-fp.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/cached-powers.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/cached-powers.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
	CompileC /Users/rod/dev/react/testing/awesome/ios/build/Build/Intermediates.noindex/React.build/Debug-iphonesimulator/double-conversion.build/Objects-normal/x86_64/bignum.o /Users/rod/dev/react/testing/awesome/node_modules/react-native/third-party/double-conversion-1.1.6/src/bignum.cc normal x86_64 c++ com.apple.compilers.llvm.clang.1_0.compiler
(7 failures)

Installing build/Build/Products/Debug-iphonesimulator/awesome.app
An error was encountered processing the command (domain=NSPOSIXErrorDomain, code=22):
Failed to install the requested application
The bundle identifier of the application could not be determined.
Ensure that the application's Info.plist contains a value for CFBundleIdentifier.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/awesome.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist


Error: Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier build/Build/Products/Debug-iphonesimulator/awesome.app/Info.plist
Print: Entry, ":CFBundleIdentifier", Does Not Exist

    at checkExecSyncError (child_process.js:602:13)
    at Object.execFileSync (child_process.js:622:13)
    at Promise.then (/Users/rod/dev/react/testing/awesome/node_modules/react-native/local-cli/runIOS/runIOS.js:208:5)
    at <anonymous>
    at process._tickCallback (internal/process/next_tick.js:189:7)

解决办法,在项目文件夹下执行:

第一步

cd node_modules/react-native/scripts && ./ios-install-third-party.sh && cd ../../../

第二步 

cd node_modules/react-native/third-party/glog-0.3.5/ && ../../scripts/ios-configure-glog.sh && cd ../../../../

 注意:第二步命令“golg-0.3.5”需要改成你的glog版本,比如我的是“golg-0.3.4”,则改成

cd node_modules/react-native/third-party/glog-0.3.4/ && ../../scripts/ios-configure-glog.sh && cd ../../../../

可以在以下文件夹查看你的golg,如图 

 解决升级到Xcode10,react native项目运行报错问题

第三步重启服务:npm start 

 

错误二:error: Build input file cannot be found: '../node_modules/react-native/Libraries/WebSocket/libfishhook.a'

这是缺少libfishhook.a文件造成的,我们可以手动添加它,如图:

解决升级到Xcode10,react native项目运行报错问题

解决升级到Xcode10,react native项目运行报错问题

 

这是我的项目,如果对你有帮助,欢迎star:https://github.com/SemperChen/NovelAPP

演示视频:https://www.bilibili.com/video/av28309525/

截图

解决升级到Xcode10,react native项目运行报错问题

 解决升级到Xcode10,react native项目运行报错问题

解决升级到Xcode10,react native项目运行报错问题 解决升级到Xcode10,react native项目运行报错问题

 解决升级到Xcode10,react native项目运行报错问题

 解决升级到Xcode10,react native项目运行报错问题