Не удалось установить модуль для проекта React-native с использованием Yarn Berry.IOS

Программируем под IOS
Ответить
Anonymous
 Не удалось установить модуль для проекта React-native с использованием Yarn Berry.

Сообщение Anonymous »

Просто я не могу установить модуль для проекта React-native, когда использую пряжу — Berry или любую более новую версию 3.x или 4.x. Есть ли кто-нибудь, кто сделал эту работу? Спасибо!
Это можно снова ввести, выполнив следующие действия:
1 — версия набора пряжи ягода
2 - npx response-native init abc
Вы получите ошибку при установке файлов модуля. То же самое и с существующими проектами. Я использую реагирующие версии 0.74.0, 0.74.1

Код: Выделить всё

 #  from /Users/administrator/Desktop/abc/ios/Podfile:2
#  -------------------------------------------
#  # Resolve react_native_pods.rb with node to allow for hoisting
>  require Pod::Executable.execute_command('node', ['-p',
#    'require.resolve(
#  -------------------------------------------
Couldn't install Pods.  Updating the Pods project and trying again...
Command `pod install` failed.
└─ Cause: Invalid `Podfile` file: [!] /opt/homebrew/bin/node -p require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
) /Users/administrator/Desktop/abc/ios

node:internal/modules/cjs/loader:1205
throw err;
^

Error: Cannot find module 'react-native/scripts/react_native_pods.rb'
Require stack:
- /Users/administrator/Desktop/abc/ios/[eval]
at Module._resolveFilename (node:internal/modules/cjs/loader:1202:15)
at Function.resolve (node:internal/modules/helpers:199:19)
at [eval]:1:9
at runScriptInThisContext (node:internal/vm:209:10)
at node:internal/process/execution:118:14
at [eval]-wrapper:6:24
at runScript (node:internal/process/execution:101:62)
at evalScript (node:internal/process/execution:136:3)
at node:internal/main/eval_string:51:3 {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/Users/administrator/Desktop/abc/ios/[eval]' ]
}

Node.js v22.0.0
Вот как выглядит мой файл pod:

Код: Выделить всё

# Resolve react_native_pods.rb with node to allow for hoisting
require Pod::Executable.execute_command('node', ['-p',
'require.resolve(
"react-native/scripts/react_native_pods.rb",
{paths: [process.argv[1]]},
)', __dir__]).strip

platform :ios, min_ios_version_supported
prepare_react_native_project!

linkage = ENV['USE_FRAMEWORKS']
if linkage != nil
Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
use_frameworks! :linkage => linkage.to_sym
end

target 'abc' do
config = use_native_modules!

use_react_native!(
:path => config[:reactNativePath],
# An absolute path to your application root.
:app_path => "#{Pod::Config.instance.installation_root}/.."
)

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

post_install do |installer|
# https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
react_native_post_install(
installer,
config[:reactNativePath],
:mac_catalyst_enabled => false,
# :ccache_enabled => true
)
end
end
И файл package.json:

Код: Выделить всё

{
"name": "abc",
"version": "0.0.1",
"private": true,
"scripts": {
"android": "react-native run-android",
"ios": "react-native run-ios",
"lint": "eslint .",
"start": "react-native start",
"test": "jest"
},
"dependencies": {
"react": "18.2.0",
"react-native": "0.74.1"
},
"devDependencies": {
"@babel/core": "^7.20.0",
"@babel/preset-env": "^7.20.0",
"@babel/runtime": "^7.20.0",
"@react-native/babel-preset": "0.74.83",
"@react-native/eslint-config": "0.74.83",
"@react-native/metro-config": "0.74.83",
"@react-native/typescript-config": "0.74.83",
"@types/react": "^18.2.6",
"@types/react-test-renderer": "^18.0.0",
"babel-jest": "^29.6.3",
"eslint": "^8.19.0",
"jest": "^29.6.3",
"prettier": "2.8.8",
"react-test-renderer": "18.2.0",
"typescript": "5.0.4"
},
"engines": {
"node": ">=18"
}
}
Спасибо!
Просто я не могу установить модуль для проекта React-native, когда использую Yarn - Berry или любую более новую версию. 3.х или 4.х. Есть ли кто-нибудь, кто сделал эту работу? Спасибо!

Подробнее здесь: https://stackoverflow.com/questions/784 ... yarn-berry
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «IOS»