• 카테고리

    질문 & 답변
  • 세부 분야

    모바일 앱 개발

  • 해결 여부

    해결됨

프로젝트가 만들어지지 않습니다.

24.04.28 01:29 작성 조회수 144

1

  • 맥북 m1으로 똑같이 설정을 했습니다.

  • 그리고 npx react-native init MatzipApp으로 프로젝트를 실행하면 아래오 같은 메시지가 나옵니다.

 Downloading template
✔ Copying template
⠸ Processing template➤ YN0000: Retrieving https://repo.yarnpkg.com/3.6.4/packages/yarnpkg-cli/bin/yarn.js
⠙ Processing template➤ YN0000: Saving the new release in ../../../.yarn/releases/yarn-3.6.4.cjs
➤ YN0000: Done in 0s 666ms
⠼ Processing template➤ YN0000: Successfully set nodeLinker to 'node-modules'
✔ Processing template
⠸ Installing dependencieserror Installing pods failed. This doesn't affect project initialization and you can safely proceed.
However, you will need to install pods manually when running iOS, follow additional steps in "Run instructions for iOS" section.

✖ Installing dependencies


info 💡 To enable automatic CocoaPods installation when building for iOS you can create react-native.config.js with automaticPodsInstallation field.
For more details, see https://github.com/react-native-community/cli/blob/main/docs/projects.md#projectiosautomaticpodsinstallation

✔ Initializing Git repository


  Run instructions for Android:
    • Have an Android emulator running (quickest way to get started), or a device connected.
    • cd "/Users/xxx/React-Project/React-Native/MatzipApp" && npx react-native run-android

  Run instructions for iOS:
    • cd "/Users/sss/React-Project/React-Native/MatzipApp/ios"

    • Install Cocoapods
      • bundle install # you need to run this only once in your project.
      • bundle exec pod install
      • cd ..

    • npx react-native run-ios
    - or -
    • Open MatzipApp/ios/MatzipAppcd .xcodeproj in Xcode or run "xed -b ios"
    • Hit the Run button

  Run instructions for macOS:
    • See https://aka.ms/ReactNativeGuideMacOS for the latest up-to-date instructions.

이런 메시지가 뜨고 npm run start로 실행을 하면 command not found메시지가 뜨면서 애뮬레이터도 실행이 안됩니다.ㅠㅠ

답변 1

답변을 작성해보세요.

0

Kyo님의 프로필

Kyo

지식공유자

2024.04.28

현재 ruby -v 를 입력했을때 어떻게 뜨나요? 2.7.6이 정상적으로 나온다면
메세지에서 Run instructions for iOS를 따라하라고 나오는데 해당부분을 따라해보시겠어요?

답변 감사합니다.

해당 부분은 해결이 됐는데 이상하게 안드로이드를 실행으 하면 실행이 안되네요.

info Opening app on Android...
info A dev server is already running for this project on port 8081.
info Installing the app...
Path for java installation '/Users/xxx/Library/Java/JavaVirtualMachines/adopt-openj9-1.8.0_292/Contents/Home' (IntelliJ IDEA) does not contain a java executable
> Task :gradle-plugin:checkKotlinGradlePluginConfigurationErrors
> Task :gradle-plugin:compileKotlin UP-TO-DATE
> Task :gradle-plugin:compileJava NO-SOURCE
> Task :gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :gradle-plugin:processResources UP-TO-DATE
> Task :gradle-plugin:classes UP-TO-DATE
> Task :gradle-plugin:jar UP-TO-DATE
5 actionable tasks: 1 executed, 4 up-to-date

info 💡 Tip: Make sure that you have set up your development environment correctly, by running npx react-native doctor. To read more about doctor command visit: https://github.com/react-native-community/cli/blob/main/packages/cli-doctor/README.md#doctor


FAILURE: Build failed with an exception.

* Where:
Build file '/Users/xxx/React-Project/React-Native/MyApp/android/app/build.gradle' line: 1

* What went wrong:
A problem occurred evaluating project ':app'.
> Failed to apply plugin 'com.android.internal.application'.
   > Android Gradle plugin requires Java 17 to run. You are currently using Java 11.
      Your current JDK is located in /Users/xxx/Library/Java/JavaVirtualMachines/corretto-11.0.21/Contents/Home
      You can try some of the following options:
       - changing the IDE settings.
       - changing the JAVA_HOME environment variable.
       - changing `org.gradle.java.home` in `gradle.properties`.

* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
> Get more help at https://help.gradle.org.

BUILD FAILED in 1s
info Run CLI with --verbose flag for more details.

이렇게 메시지가 나오고 안드로이드 빌드가 실패되서
npx react-native doctor를 실행을 하면

Android
 ✓ Adb - Required to verify if the android device is attached correctly
 ✓ JDK - Required to compile Java code
 ✓ Android Studio - Required for building and installing your app on Android
 ✓ ANDROID_HOME - Environment variable that points to your Android SDK installation
 ✓ Gradlew - Build tool required for Android builds
 ✖ Android SDK - Required for building and installing your app on Android
   - Versions found: N/A
   - Version supported: 34.0.0

이렇게 나옵니다.

분명 sdk 버전도 제대로 설치를 했고,

adb version 을 실행하면 아래와 같이 버전 정보도 잘 나옵니다.

Android Debug Bridge version 1.0.41
Version 35.0.1-11580240
Installed as /Users/xxx/Library/Android/sdk/platform-tools/adb
Running on Darwin 23.4.0 (arm64)

sdk 버전도 문제없는데 왜 안드로이드 기기는 실행이 안되는지 모르겠네요..ㅠㅠ

ios는 정상적으로 실행이 잘 됩니다.

Kyo님의 프로필

Kyo

지식공유자

2024.04.29

혹시 프로젝트생성할때 리액트네이티브 버전을 몇으로하셨나요??

버전을 따로 설정하지 않아서 최신버전으로 된 것 같아요.

이리저리 검색해보니 ReactNative의 종속성을 최신버전으로 해보라고 해서

npm install을 한 후 실행을 해 보니 정상적으로 실행이 되네요..

한 단계 한 단계가 쉽지가 않네요.ㅠㅠ

Kyo님의 프로필

Kyo

지식공유자

2024.04.29

강의와다르게 최신버전으로 진행하셔서, 지금Java버전이 문제인데요. java17버전으로 업데이트하시거나, 0.72.6으로 진행해주시면 될것같습니다!

brew tap homebrew/cask-versions
brew install --cask zulu17

또는 프로젝트를 그냥 0.72.6으로 진행하시는것을 추천드립니다.

Kyo님의 프로필

Kyo

지식공유자

2024.04.29

안드로이드도 해결되신걸까요?

이상하게 npm install을 한 후에 npm run start 로 안드로이드와 iOS가 잘 떴는데
메트로 서버를 나갔다가 다시 실행하면 또 똑같은 오류가 발생되네요...ㅠㅠ

 

자바 버전은 현재 17버전으로 설정이 되어있는 상태입니다.
프로젝트 생성만 강의와 맞는 버전으로 설정해서 다시 해 봐야겠네요..