簡體   English   中英

蘋果M1。 React-native 無法為 iOS 模擬器構建

[英]Apple M1. React-native can't build for iOS simulator

我為 react native 安裝了所有依賴項。 沒有羅塞塔的所有設置。 我在 react-native 中創建了一個新項目。 然后我在終端 npx react-native run-ios 中運行。 模擬器啟動。 但是項目沒有建立。 日志:

0 verbose cli [
0 verbose cli   '/opt/homebrew/Cellar/node/15.8.0/bin/node',
0 verbose cli   '/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js',
0 verbose cli   'exec',
0 verbose cli   '--',
0 verbose cli   'react-native',
0 verbose cli   'run-ios'
0 verbose cli ]
1 info using npm@7.5.2
2 info using node@v15.8.0
3 timing config:load:defaults Completed in 0ms
4 timing config:load:file:/opt/homebrew/lib/node_modules/npm/npmrc Completed in 1ms
5 timing config:load:builtin Completed in 1ms
6 timing config:load:cli Completed in 0ms
7 timing config:load:env Completed in 0ms
8 timing config:load:file:/Users/kornick/test2/.npmrc Completed in 0ms
9 timing config:load:project Completed in 1ms
10 timing config:load:file:/Users/kornick/.npmrc Completed in 0ms
11 timing config:load:user Completed in 0ms
12 timing config:load:file:/opt/homebrew/etc/npmrc Completed in 0ms
13 timing config:load:global Completed in 0ms
14 timing config:load:cafile Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:setUserAgent Completed in 0ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 2ms
19 verbose npm-session 9b37ce5d0c1fcd8b
20 timing npm:load Completed in 6ms
21 timing command:exec Completed in 32017ms
22 verbose stack Error: command failed
22 verbose stack     at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/index.js:64:27)
22 verbose stack     at ChildProcess.emit (node:events:378:20)
22 verbose stack     at maybeClose (node:internal/child_process:1067:16)
22 verbose stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:301:5)
23 verbose pkgid test2@0.0.1
24 verbose cwd /Users/kornick/test2
25 verbose Darwin 20.2.0
26 verbose argv "/opt/homebrew/Cellar/node/15.8.0/bin/node" "/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js" "exec" "--" "react-native" "run-ios"
27 verbose node v15.8.0
28 verbose npm  v7.5.2
29 error code 1
30 error path /Users/kornick/test2
31 error command failed
32 error command sh -c react-native "run-ios"
33 verbose exit 1

接下來是解決方案。 我編輯了 Podfile,在此之前我重新閱讀了很多信息。 我的播客文件。 編輯后我運行了 pod install。

require_relative '../node_modules/react-native/scripts/react_native_pods'
require_relative '../node_modules/@react-native-community/cli-platform-ios/native_modules'

platform :ios, '10.0'

target 'test2' do
  config = use_native_modules!

  use_react_native!(:path => config["reactNativePath"])

  target 'test2Tests' do
    inherit! :complete
    # Pods for testing
  end

  # Enables Flipper.
  #
  # Note that if you have use_frameworks! enabled, Flipper will not work and
 # you should disable these next few lines.
  #use_flipper!
  post_install do |installer|
    #flipper_post_install(installer)
    installer.pods_project.targets.each do |target|
    target.build_configurations.each do |config|
      config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
    end
  end
  end
end

target 'test2-tvOS' do
  # Pods for test2-tvOS

  target 'test2-tvOSTests' do
    inherit! :search_paths
    # Pods for testing
  end
end

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM