ios - 苹果M1。 React-native 无法为 iOS 模拟器构建

标签 ios macos react-native apple-m1

我安装了 React Native 的所有依赖项。没有 Rosseta 的所有设置。 我在 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

关于ios - 苹果M1。 React-native 无法为 iOS 模拟器构建,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/66093047/

相关文章:

ios - 触摸结束声音?

ios - Swift:SearchBar 在parentViewController 上保持可见

python - Docker 进程被神秘的 `Killed` 消息杀死

macos - DS-5 支持 Mac OS X

javascript - react native : No propType for native prop RCTView. 最大高度

ios - iphone 多语言支持

macos - 在Mac中计算目录及其子目录的特定文件类型的数量

java - 检测在 MainActivity.java 中 Detox 上下文下运行的 Android React Native 应用程序

javascript - WebStorm 无法解析导入语句

ios - 如何在 SpriteKit 游戏中禁用第二次触摸?