web-dev-qa-db-ja.com

Podfile.lockが、最初のネイティブのrun-iosに反応しない

IOS dev for React動作しているネイティブ(0.61)アプリAndroid=バージョン。オンラインポスト(インストールされたxcodeコマンドラインツール10.2)に従ってネイティブ環境が設定された後、コンポーネントのsrcとpackage.jsonファイルをコピーすることでしたが、run-iosの起動に失敗しました:

_$ react-native run-ios
error Could not find "Podfile.lock" at /Users/mine/Documents/code/js/emps_fe6/ios/Podfile.lock. Did you run "pod install" in iOS directory?
error Could not find the following native modules: RNCAsyncStorage, RNDeviceInfo, RNGestureHandler, RNKeychain, BVLinearGradient, RNLocalize, RNReanimated, RNVectorIcons, react-native-video. Did you forget to run "pod install" ?
info Found Xcode project "emps_fe6.xcodeproj"
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH
error Could not parse the simulator list output. Run CLI with --verbose flag for more details.
Error: Command failed: xcrun simctl list --json devices
xcrun: error: unable to find utility "simctl", not a developer tool or in PATH

    at checkExecSyncError (child_process.js:629:11)
    at Object.execFileSync (child_process.js:647:13)
    at runOnSimulator (/Usersamine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:130:54)
    at Object.runIOS [as func] (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:100:12)
    at Command.handleAction (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:164:23)
    at Command.listener (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:198:13)
    at Command.parseArgs (/Users/amine/Documents/code/js/emps_fe6/node_modules/commander/index.js:651:12)
    at Command.parse (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:474:21)
    at setupAndRun (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:237:24)
_

以下は、react native infoの出力です。

_$ react-native info
info Fetching system and libraries information...
System:
    OS: macOS High Sierra 10.13.6
    CPU: (8) x64 Intel(R) Core(TM) i7-2675QM CPU @ 2.20GHz
    Memory: 194.93 MB / 8.00 GB
    Shell: 3.2.57 - /bin/bash
  Binaries:
    Node: 10.17.0 - /usr/local/bin/node
    Yarn: 1.19.1 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  IDEs:
    Xcode: /undefined - /usr/bin/xcodebuild
  npmPackages:
    react: 16.11.0 => 16.11.0 
    react-native: 0.61.2 => 0.61.2 
  npmGlobalPackages:
    react-native-cli: 2.0.1
_

これがpackage.jsonです:

_"dependencies": {
    "@react-native-community/async-storage": "^1.6.2",
    "moment": "^2.24.0",
    "react": "16.11.0",
    "react-native": "0.61.2",
    "react-native-cli": "^2.0.1",
    "react-native-confirmation-code-field": "^4.1.0",
    "react-native-device-info": "^4.0.1",
    "react-native-elements": "^1.2.6",
    "react-native-gesture-handler": "^1.4.1",
    "react-native-gifted-chat": "^0.11.3",
    "react-native-keychain": "^4.0.1",
    "react-native-linear-gradient": "^2.5.6",
    "react-native-localize": "^1.3.1",
    "react-native-modal": "^11.4.0",
    "react-native-modal-datetime-picker": "^7.6.0",
    "react-native-reanimated": "^1.3.0",
    "react-native-segmented-control-tab": "^3.4.1",
    "react-native-vector-icons": "^6.6.0",
    "react-native-video": "^5.0.2",
    "react-navigation": "^4.0.10",
    "react-navigation-stack": "^1.10.2",
    "react-navigation-tabs": "^2.5.6",
    "simctl": "^2.0.0",
    "socket.io-client": "2.1.1",
    "xcode": "^2.0.0"
  },
_

エラーメッセージでは、不足しているかなりの数のモジュールが言及されていました。しかし、package.jsonに示されているように、これらのモジュールはインストールされています。エラーメッセージの意味がわかりません。また、simctlをインストールしましたが、_scrum simctl_でもまだ見つかりません。 IDEとしてVS Codeを使用しています。

更新:

/ iosの下に空の_Podfile.lock_を作成した場合、run-iosを実行するとエラーになります。

_error Cannot read property 'SPEC CHECKSUMS' of undefined. Run CLI with --verbose flag for more details.
TypeError: Cannot read property 'SPEC CHECKSUMS' of undefined
    at getDependenciesFromPodfileLock (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/link-pods/getDependenciesFromPodfileLock.js:63:58)
    at warnAboutPodInstall (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/link/warnAboutPodInstall.js:43:67)
    at Object.runIOS [as func] (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli-platform-ios/build/commands/runIOS/index.js:80:36)
    at Command.handleAction (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:164:23)
    at Command.listener (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:315:8)
    at Command.emit (events.js:198:13)
    at Command.parseArgs (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:651:12)
    at Command.parse (/Users/mine/Documents/code/js/emps_fe6/node_modules/commander/index.js:474:21)
    at setupAndRun (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:237:24)
    at Object.run (/Users/mine/Documents/code/js/emps_fe6/node_modules/@react-native-community/cli/build/index.js:184:11)
_
4
user938363

ステップ1:

Sudo gem install cocoapods

ステップ2:

cd ios && pod install && cd ../ && react-native run-ios

それでもポッドのインストール中にエラーが発生する場合は、以下の手順に進んでください。

ステップ3:これをコンソールに配置する->

xcrun -k --sdk iphoneos --show-sdk-path

答えが

xcrun:_ error: SDK "iphoneos" cannot be located
xcrun: error: SDK "iphoneos" cannot be located
xcrun: error: unable to lookup item 'Path' in SDK 'iphoneos'

次にこれを入れます:

Sudo xcode-select --switch /Applications/Xcode.app

次に、ポッドを再度インストールします

0
Samim Hakimi