繁体   English   中英

未能构建 iOS 项目。 我们运行了“xcodebuild”命令,但它以错误代码 65 退出

[英]Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65

我是反应原生开发的新手。 我正在使用带有 M1 芯片的新 MacBook Air(M1,2020)。 我已经安装了以下依赖项:

Node =  v14.15.3
Npm  = 6.14.9
Homebrew  = 2.7.0
react-native-cli: 2.0.1
Xcode Version 12.3

项目创建日志如下:

alimran@Als-MacBook-Air prod % react-native init test
This will walk you through creating a new React Native project in /Users/alimran/workspace/reactnative/prod/test
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated

> fsevents@1.2.13 install /Users/alimran/workspace/reactnative/prod/test/node_modules/fsevents
> node install.js

  SOLINK_MODULE(target) Release/.node
  CXX(target) Release/obj.target/fse/fsevents.o
  SOLINK_MODULE(target) Release/fse.node

> core-js@2.6.12 postinstall /Users/alimran/workspace/reactnative/prod/test/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)

npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-native@0.63.4 requires a peer of react@16.13.1 but none is installed. You must install peer dependencies yourself.
npm WARN use-subscription@1.5.1 requires a peer of react@^16.8.0 || ^17.0.0 but none is installed. You must install peer dependencies yourself.

+ react-native@0.63.4
added 732 packages from 414 contributors and audited 732 packages in 39.586s

12 packages are looking for funding
  run `npm fund` for details

found 3 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
info Setting up new React Native app in /Users/alimran/workspace/reactnative/prod/test
(node:14642) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
info Adding required dependencies
+ react@16.13.1
added 1 package and audited 735 packages in 3.979s

12 packages are looking for funding
  run `npm fund` for details

found 3 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
info Adding required dev dependencies
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported

> core-js-pure@3.8.1 postinstall /Users/alimran/workspace/reactnative/prod/test/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"

npm WARN tsutils@3.17.1 requires a peer of typescript@>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.

+ metro-react-native-babel-preset@0.59.0
+ @babel/core@7.12.10
+ babel-jest@25.5.1
+ @babel/runtime@7.12.5
+ jest@25.5.4
+ eslint@6.8.0
+ react-test-renderer@16.13.1
+ @react-native-community/eslint-config@1.1.0
added 582 packages from 308 contributors, updated 3 packages and audited 1317 packages in 24.86s

57 packages are looking for funding
  run `npm fund` for details

found 3 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details
info Installing required CocoaPods dependencies
(node:14642) UnhandledPromiseRejectionWarning: Error: Failed to install CocoaPods dependencies for iOS project, which is required by this template.
Please try again manually: "cd ./test/ios && pod install".
CocoaPods documentation: https://cocoapods.org/
    at runPodInstall (/Users/alimran/workspace/reactnative/prod/test/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/installPods.js:99:13)
    at processTicksAndRejections (internal/process/task_queues.js:93:5)
    at async installPods (/Users/alimran/workspace/reactnative/prod/test/node_modules/react-native/node_modules/@react-native-community/cli/build/tools/installPods.js:222:5)
    at async generateProject (/Users/alimran/workspace/reactnative/prod/test/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/initCompat.js:136:5)
    at async Object.initCompat (/Users/alimran/workspace/reactnative/prod/test/node_modules/react-native/node_modules/@react-native-community/cli/build/commands/init/initCompat.js:105:3)
(node:14642) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 2)
(node:14642) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
alimran@Als-MacBook-Air prod % 

Pod 手动安装结果:

alimran@Als-MacBook-Air prod % cd test
alimran@Als-MacBook-Air test % ls
App.js          app.json        ios         package-lock.json
__tests__       babel.config.js     metro.config.js     package.json
android         index.js        node_modules
alimran@Als-MacBook-Air test % cd ios
alimran@Als-MacBook-Air ios % sudo pod install
Password:
Traceback (most recent call last):
    5: from /usr/local/bin/pod:23:in `<main>'
    4: from /usr/local/bin/pod:23:in `load'
    3: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/bin/pod:55:in `<top (required)>'
    2: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:48:in `run'
    1: from /Library/Ruby/Gems/2.6.0/gems/cocoapods-1.10.0/lib/cocoapods/command.rb:102:in `ensure_not_root_or_allowed!'
/Library/Ruby/Gems/2.6.0/gems/claide-1.0.3/lib/claide/command.rb:439:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)

Usage:

    $ pod COMMAND

      CocoaPods, the Cocoa library package manager.

Commands:

    + cache        Manipulate the CocoaPods cache
    + env          Display pod environment
    + init         Generate a Podfile for the current directory
    + install      Install project dependencies according to versions from a
                   Podfile.lock
    + ipc          Inter-process communication
    + lib          Develop pods
    + list         List pods
    + outdated     Show outdated project dependencies
    + repo         Manage spec-repositories
    + setup        Setup the CocoaPods environment
    + spec         Manage pod specs
    + update       Update outdated project dependencies and create new Podfile.lock

Options:

    --allow-root   Allows CocoaPods to run as root
    --silent       Show nothing
    --version      Show the version of the tool
    --verbose      Show more debugging information
    --no-ansi      Show output without ANSI codes
    --help         Show help banner of specified command
alimran@Als-MacBook-Air ios % 

项目运行错误如下:

alimran@Als-MacBook-Air test % react-native run-ios
error Could not find "Podfile.lock" at /Users/alimran/workspace/reactnative/prod/test/ios/Podfile.lock. Did you run "pod install" in iOS directory?
info Found Xcode project "test.xcodeproj"
info Building (using "xcodebuild -project test.xcodeproj -configuration Debug -scheme test -destination id=06B32499-BA8E-488E-B934-FDC4C7D2A385")
(node:16530) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
error Failed to build iOS project. We ran "xcodebuild" command but it exited with error code 65. To debug build logs further, consider building your app with Xcode.app, by opening test.xcodeproj. Run CLI with --verbose flag for more details.
Command line invocation:
    /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild -project test.xcodeproj -configuration Debug -scheme test -destination id=06B32499-BA8E-488E-B934-FDC4C7D2A385

note: Using new build system
note: Building targets in parallel
note: Planning build
note: Constructing build description
warning: Capabilities for Signing & Capabilities may not function correctly because its entitlements use a placeholder team ID. To resolve this, select a development team in the test editor. (in target 'test' from project 'test')
ProcessProductPackaging "" /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test.app-Simulated.xcent (in target 'test' from project 'test')
    cd /Users/alimran/workspace/reactnative/prod/test/ios
    

Entitlements:

{
    "application-identifier" = "FAKETEAMID.org.reactjs.native.example.test";
    "keychain-access-groups" =     (
        "FAKETEAMID.org.reactjs.native.example.test"
    );
}


    builtin-productPackagingUtility -entitlements -format xml -o /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test.app-Simulated.xcent

ProcessProductPackaging "" /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test.app.xcent (in target 'test' from project 'test')
    cd /Users/alimran/workspace/reactnative/prod/test/ios
    

Entitlements:

{
    "com.apple.security.get-task-allow" = 1;
}


    builtin-productPackagingUtility -entitlements -format xml -o /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test.app.xcent

PhaseScriptExecution Start\ Packager /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Script-FD10A7F022414F080027D42C.sh (in target 'test' from project 'test')
    cd /Users/alimran/workspace/reactnative/prod/test/ios
    /bin/sh -c /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Script-FD10A7F022414F080027D42C.sh

CompileC /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/main.o /Users/alimran/workspace/reactnative/prod/test/ios/test/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'test' from project 'test')
    cd /Users/alimran/workspace/reactnative/prod/test/ios
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target x86_64-apple-ios10.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path\=/Users/alimran/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/alimran/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DDEBUG\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -fobjc-abi-version\=2 -fobjc-legacy-dispatch -index-store-path /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Index/DataStore -iquote /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-generated-files.hmap -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-own-target-headers.hmap -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-all-target-headers.hmap -iquote /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-project-headers.hmap -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Products/Debug-iphonesimulator/include -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources-normal/x86_64 -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources/x86_64 -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources -F/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Products/Debug-iphonesimulator -MMD -MT dependencies -MF /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/main.d --serialize-diagnostics /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/main.dia -c /Users/alimran/workspace/reactnative/prod/test/ios/test/main.m -o /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/main.o
In file included from /Users/alimran/workspace/reactnative/prod/test/ios/test/main.m:3:
/Users/alimran/workspace/reactnative/prod/test/ios/test/AppDelegate.h:1:9: fatal error: 'React/RCTBridgeDelegate.h' file not found
#import <React/RCTBridgeDelegate.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.

CompileC /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/AppDelegate.o /Users/alimran/workspace/reactnative/prod/test/ios/test/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler (in target 'test' from project 'test')
    cd /Users/alimran/workspace/reactnative/prod/test/ios
    export LANG\=en_US.US-ASCII
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -x objective-c -target x86_64-apple-ios10.0-simulator -fmessage-length\=0 -fdiagnostics-show-note-include-stack -fmacro-backtrace-limit\=0 -std\=gnu99 -fobjc-arc -fmodules -gmodules -fmodules-cache-path\=/Users/alimran/Library/Developer/Xcode/DerivedData/ModuleCache.noindex -fmodules-prune-interval\=86400 -fmodules-prune-after\=345600 -fbuild-session-file\=/Users/alimran/Library/Developer/Xcode/DerivedData/ModuleCache.noindex/Session.modulevalidation -fmodules-validate-once-per-build-session -Wnon-modular-include-in-framework-module -Werror\=non-modular-include-in-framework-module -Wno-trigraphs -fpascal-strings -O0 -fno-common -Wno-missing-field-initializers -Wno-missing-prototypes -Werror\=return-type -Wunreachable-code -Wno-implicit-atomic-properties -Werror\=deprecated-objc-isa-usage -Wno-objc-interface-ivars -Werror\=objc-root-class -Wno-arc-repeated-use-of-weak -Wimplicit-retain-self -Wduplicate-method-match -Wno-missing-braces -Wparentheses -Wswitch -Wunused-function -Wno-unused-label -Wno-unused-parameter -Wunused-variable -Wunused-value -Wempty-body -Wuninitialized -Wconditional-uninitialized -Wno-unknown-pragmas -Wno-shadow -Wno-four-char-constants -Wno-conversion -Wconstant-conversion -Wint-conversion -Wbool-conversion -Wenum-conversion -Wno-float-conversion -Wnon-literal-null-conversion -Wobjc-literal-conversion -Wshorten-64-to-32 -Wpointer-sign -Wno-newline-eof -Wno-selector -Wno-strict-selector-match -Wundeclared-selector -Wdeprecated-implementations -DDEBUG\=1 -DOBJC_OLD_DISPATCH_PROTOTYPES\=0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.3.sdk -fasm-blocks -fstrict-aliasing -Wprotocol -Wdeprecated-declarations -g -Wno-sign-conversion -Winfinite-recursion -Wcomma -Wblock-capture-autoreleasing -Wstrict-prototypes -Wno-semicolon-before-method-body -fobjc-abi-version\=2 -fobjc-legacy-dispatch -index-store-path /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Index/DataStore -iquote /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-generated-files.hmap -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-own-target-headers.hmap -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-all-target-headers.hmap -iquote /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/test-project-headers.hmap -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Products/Debug-iphonesimulator/include -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources-normal/x86_64 -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources/x86_64 -I/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/DerivedSources -F/Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Products/Debug-iphonesimulator -MMD -MT dependencies -MF /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/AppDelegate.d --serialize-diagnostics /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/AppDelegate.dia -c /Users/alimran/workspace/reactnative/prod/test/ios/test/AppDelegate.m -o /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/AppDelegate.o
In file included from /Users/alimran/workspace/reactnative/prod/test/ios/test/AppDelegate.m:1:
/Users/alimran/workspace/reactnative/prod/test/ios/test/AppDelegate.h:1:9: fatal error: 'React/RCTBridgeDelegate.h' file not found
#import <React/RCTBridgeDelegate.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~
1 error generated.


** BUILD FAILED **


The following build commands failed:
    CompileC /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/main.o /Users/alimran/workspace/reactnative/prod/test/ios/test/main.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
    CompileC /Users/alimran/Library/Developer/Xcode/DerivedData/test-alolrygzfwbwxdfvdrglncimtovw/Build/Intermediates.noindex/test.build/Debug-iphonesimulator/test.build/Objects-normal/x86_64/AppDelegate.o /Users/alimran/workspace/reactnative/prod/test/ios/test/AppDelegate.m normal x86_64 objective-c com.apple.compilers.llvm.clang.1_0.compiler
(2 failures)

alimran@Als-MacBook-Air test % 

请参阅下面的文件夹结构。 在此处输入图像描述 我希望有些人对这个问题有适当的解决方案。 #谢谢

这是已知的 Flipper 问题

1- PodFile 上的评论Flipper

  post_install do |installer|
    flipper_post_install(installer)
  end

在此处输入图像描述

2- 安装 pod cd ios/ && pod install

3-现在你应该可以运行 Simulator cd.. && yarn ios

这是关于的未解决问题: https://github.com/facebook/flipper/issues/1940

我自己解决了我的问题。 如果有人遇到此问题,请按照以下步骤操作。 我希望它对解决您的问题有所帮助。

  1. 首先如果你已经在你的计算机上全局安装了react-native-cli旧版本,请卸载它,因为我们不需要它。
  2. 如果您安装了 Pod 最新版本,请将其卸载并安装较早版本: sudo gem install cocoapods -v 1.8.4
  3. 然后 go 到您的工作文件夹并通过 npx 创建一个新项目: npx react-native init AwesomeProject -或- npx react-native init AwesomeProject --version X.XX.X
  4. 然后 go 到你新创建的项目目录:cd AwesomeProject。
  5. Go 到 IOS 文件夹: cd ios
  6. 安装吊舱: pod install
  7. 返回项目的根目录: cd..
  8. 运行命令: npx react-native start
  9. 打开另一个终端并运行命令: npx react-native run-ios

我的问题通过上面的几个陡峭的方法解决了,我希望它对你有帮助。

用罗塞塔打开终端,它让我用罗塞塔打开

在我的情况下,它通过重新克隆 repo 并再次运行它来解决。

设置:Xcode 12.4 Mac M1 react-native 63.4

如果你有 Apple M1 芯片,最新版本的 cocoapods 不完全兼容。

修复这样做:

  1. 须藤宝石卸载cocoapods
  2. 须藤宝石安装 cocoapods -v 1.8.4
  3. npx 吊舱安装

我在运行“npx run-ios”时遇到了这个问题

结果我的电脑上安装了 2 个 Xcode(11.7, 12.4),终端上运行的默认版本是 Xcode 11.7,它存在一些问题(项目无法在 11.7 上打开,而 12.4 可以)

我更改了默认版本并按照此处所述解决了它: https://stackoverflow.com/a/58229921/11266070

我使用 brew 安装 CocoaPods 并为我解决了所有问题。

brew install cocoapods

清理 xcode 中的构建并在 vsCode 中运行 ---> npx react-native run-ios

暂无
暂无

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

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