سلام من قدم به قدم با شما پیش رفتم ولی در مرحله بعد ار نصب ابزارها جی اس و ... با ران کردن دستور react-native run-adroid با ارور زیر مواجه میشم
PS C:\Users\BD&VT\desktop\projects\reactnative\firstproject> react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
'VT\Desktop\projects\ReactNative\firstproject\android\' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
PS C:\Users\BD&VT\desktop\projects\reactnative\firstproject>
سلام دوست من
دستور زیر رو اجرا کنید
react-native upgrade
اگر مشکل حل شد که هیچ اگر نشد فولدر android و ios رو پاک کنید و دستورات زیر رو اجرا کنید
react-native eject
react-native run-android
از وی پی ان استفاده کنید
مشکلی بود در خدمتم
موفق باشید
انجام دادم نشد اینم نتیجش
PS C:\Users\BD&VT\desktop\projects\reactnative\firstproject> react-native upgrade
info No version passed. Fetching latest...
warn Specified version "0.59.9" is already installed in node_modules and it satisfies "0.59.9" semver range. No need to upgrade
PS C:\Users\BD&VT\desktop\projects\reactnative\firstproject> react-native eject
info Generating the iOS folder.
info Generating the Android folder.
PS C:\Users\BD&VT\desktop\projects\reactnative\firstproject> react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
'VT\Desktop\projects\ReactNative\firstproject\android\' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
PS C:\Users\BD&VT\desktop\projects\reactnative\firstproject>
چک کنید که متغییر محیطی ANDROID_HOME رو به درستی ایجاد کرده باشید
با فیلتر شکن هم نشد همان ارور دوباره ایجاد شد
من به 60 روش سامورایی امتحان کردم نشد پوشه ها پاک کردم دوباره ساختم
فیلتر شکن روشن کردم
مسیر از اول با اسم های مختلف پروژه تست کردم
نوع شبیه ساز اندروید تغییر دادم
متغییر اندروید هوم و دی بی دوباره ست کردم بی فایدس همون خطا ظاهر میشه
کل مسیر
PS C:\Users\BD&VT\desktop\projects> cd ReactNative
PS C:\Users\BD&VT\desktop\projects\ReactNative> npm i -g react-native-cli
C:\Users\BD&VT\AppData\Roaming\npm\react-native -> C:\Users\BD&VT\AppData\Roaming\npm\node_modules\react-native-cli\index.js
+ react-native-cli@2.0.1
updated 1 package in 156.013s
PS C:\Users\BD&VT\desktop\projects\ReactNative> react-native init fristproject
prompt: Directory fristproject already exists. Continue?: (no)
Project initialization canceled
PS C:\Users\BD&VT\desktop\projects\ReactNative> react-native init fristproject
prompt: Directory fristproject already exists. Continue?: (no) y
This will walk you through creating a new React Native project in C:\Users\BD&VT\desktop\projects\ReactNative\fristproject
'yarn' is not recognized as an internal or external command,
operable program or batch file.
Installing react-native...
Consider installing yarn to make this faster: https://yarnpkg.com
npm WARN deprecated core-js@1.2.7: core-js@<2.6.8 is no longer maintained. Please, upgrade to core-js@3 or at least to actual version of core-js@2.
> core-js@3.1.3 postinstall C:\Users\BD&VT\desktop\projects\ReactNative\fristproject\node_modules\@babel\register\node_modules\core-js
> node scripts/postinstall || echo "ignore"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
> core-js@2.6.9 postinstall C:\Users\BD&VT\desktop\projects\ReactNative\fristproject\node_modules\core-js
> node scripts/postinstall || echo "ignore"
Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!
The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN react-native@0.59.9 requires a peer of react@16.8.3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ react-native@0.59.9
added 653 packages from 367 contributors and audited 31708 packages in 365.025s
found 11 low severity vulnerabilities
run `npm audit fix` to fix them, or `npm audit` for details
info Setting up new React Native app in C:\Users\BD&VT\desktop\projects\ReactNative\fristproject
info Adding required dependencies
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ react@16.8.3
added 2 packages in 35.683s
info Adding required dev dependencies
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ react-test-renderer@16.8.3
+ @babel/core@7.4.5
+ jest@24.8.0
+ metro-react-native-babel-preset@0.54.1
+ @babel/runtime@7.4.5
+ babel-jest@24.8.0
added 531 packages from 273 contributors and updated 4 packages in 283.057s
Run instructions for iOS:
• cd C:\Users\BD&VT\desktop\projects\ReactNative\fristproject && react-native run-ios
- or -
• Open ios\fristproject.xcodeproj in Xcode
• Hit the Run button
Run instructions for Android:
• Have an Android emulator running (quickest way to get started), or a device connected.
• cd C:\Users\BD&VT\desktop\projects\ReactNative\fristproject && react-native run-android
PS C:\Users\BD&VT\desktop\projects\ReactNative> react-native init fristproject
prompt: Directory fristproject already exists. Continue?: (no)
Project initialization canceled
PS C:\Users\BD&VT\desktop\projects\ReactNative> cd .\fristproject\
PS C:\Users\BD&VT\desktop\projects\ReactNative\fristproject> react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
'VT\Desktop\projects\ReactNative\fristproject\android\' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
PS C:\Users\BD&VT\desktop\projects\ReactNative\fristproject> react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
'VT\Desktop\projects\ReactNative\fristproject\android\' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
PS C:\Users\BD&VT\desktop\projects\ReactNative\fristproject> react-native upgrade
info No version passed. Fetching latest...
warn Specified version "0.59.9" is already installed in node_modules and it satisfies "0.59.9" semver range. No need to upgrade
PS C:\Users\BD&VT\desktop\projects\ReactNative\fristproject> react-native eject
info Generating the iOS folder.
info Generating the Android folder.
PS C:\Users\BD&VT\desktop\projects\ReactNative\fristproject> react-native run-android
info Starting JS server...
info Building and installing the app on the device (cd android && gradlew.bat app:installDebug)...
'VT\Desktop\projects\ReactNative\fristproject\android\' is not recognized as an internal or external command,
operable program or batch file.
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Could not install the app on the device, read the error above for details.
Make sure you have an Android emulator running or a device connected and have
set up your Android development environment:
https://facebook.github.io/react-native/docs/getting-started.html
error Command failed: gradlew.bat app:installDebug. Run CLI with --verbose flag for more details.
PS C:\Users\BD&VT\desktop\projects\ReactNative\fristproject>
مشکل مشخص نشد از چی هست استاد ؟
سلام داداش منم با همین مشکل روبرو شدم
و چندروز درگیرش بودم و دهنم سرویس کرد :| با فیلترشکن های تونل پلاس و کریو اپن ویپی ان همه ی اینا تست کردم اما فقط V#P#N جواب میده مطمن باش مشکل از چیز دیگه نیست فقط V#P#N ترجیحا سرور آمریکا وصل شو 10-15 دقیقه زمان میبره و نصب میشه. فقط همه چیز پاک کن و مراحل از اول با V=P=N برو
خیالت راحت
کامل درسته با فیلتر شکن دیگه تست کردم
درست شد امروز ممنون ❤
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 856 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Installing the app...
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
error Failed to install the app. Make sure you have the Android development environment set up: https://facebook.github.io/react-native/docs/getting-started.html#android-development-environment. Run CLI with --verbose
flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
Error: Could not find or load main class org.gradle.wrapper.GradleWrapperMain
at checkExecSyncError (child_process.js:629:11)
at execFileSync (child_process.js:647:13)
at runOnAllDevices (G:\پروژه react project\myApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:75:39)
at buildAndRun (G:\پروژه react project\myApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:155:41)
at then.result (G:\پروژه react project\myApp\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:121:12)
at process._tickCallback (internal/process/next_tick.js:68:7)
مشکل این ارور چیست؟
دنبال جوتب نباش اینجا استاد صاحب سایت پشتیبانی هنه خوابن من اینقدر جواب نگرفتم بیخیال اینجا شدم
سلام و عرض احترام
من هم تمامی مراحل آموزش را کامل انجام دادم و همه چیز نصب شد.ولی در دستور react-native run-android مشکل دارم
وی-پی-ان /ف-ی-ل-ت-ر-ش-ک-ن هم استفاده کردم.روش های بالا را هم امتحان کردم ولی بازم خظای زیر را میده
PS D:\reactnative\p2> react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 864 file(s) to forward-jetify. Using 8 workers...
info JS server already running.
info Launching emulator...
error Failed to launch emulator. Reason: Emulator exited before boot..
warn Please launch an emulator manually or connect a device. Otherwise app may fail to launch.
info Installing the app...
> Task :app:installDebug FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 6.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/5.5/userguide/command_line_interface.html#sec:command_line_warnings
27 actionable tasks: 2 executed, 25 up-to-date
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 4s
error Failed to install the app. Make sure you have an Android emulator running or a device connected. Run CLI with --verbose flag for more details.
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:installDebug'.
> com.android.builder.testing.api.DeviceException: No connected devices!
* 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 4s
at checkExecSyncError (child_process.js:630:11)
at execFileSync (child_process.js:648:15)
at runOnAllDevices (D:\reactnative\p2\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:94:39)
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (D:\reactnative\p2\node_modules\react-native\node_modules\@react-native-community\cli\build\index.js:182:9)
PS D:\reactnative\p2>
دوباره سلام.مشکلم حل شد.
وقتی خطا را ارسال کردم متوجه خط
Error: Command failed: gradlew.bat app:installDebug -PreactNativeDevServerPort=8081
شدم.قابل توجه دوستانی که مثل من این مشکل را دارن
پورت 8081 را با دستور زیر عوض کردم و مشکلم حل شد
react-native start --port 9988