4
respostas

react-native run-android pelo power shell

Quando digitei o comando react-native run-android pelo power shell apareceu seguinte mensagem: react-native: O arquivo C: \ Users \ junio \ AppData \ Roaming \ npm \ react-native.ps1 não pode ser carregado porque uma execução de scripts foi desabilitada neste sistema. Para obter mais informações, consulte about_Execution_Policies em https://go.microsoft.com/fwlink/?LinkID=135170. Sem linha: 1 caractere: 1

  • react-nativo run-android
  • ~
    • CategoryInfo: ErrodeSegurança: (:) [], PSSecurityException
    • FullyQualifiedErrorId: UnauthorizedAccess
4 respostas

Tive o mesmo problema, bastou eu dar esse comando dentro da pasta que resolveu meu problema! primeiro abri o powershell e entrei na pasta utilizando o comando cd e dentro da pasta eu coloquei esse comando Set-ExecutionPolicy RemoteSigned mais explicações estão no link abaixo!

https://pt.stackoverflow.com/questions/220078/o-que-significa-o-erro-execu%C3%A7%C3%A3o-de-scripts-foi-desabilitada-neste-sistema

O andré eu fiz como solicitou mas tive que executar como administrador no Power Shell deu certo porém agora quando eu usei o comando: PS C:\Users\junio\projeto\Android_Studio\Instalura> react-native run-android

apareceu erro na hora de BUILD:

Task :app:compileDebugJavaWithJavac 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.4.1/userguide/command_line_interface.html#sec:command_line_warnings 13 actionable tasks: 13 executed

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

    Could not find tools.jar. Please check that C:\Program Files (x86)\Java\jre1.8.0_271 contains a valid JDK installation.

  • 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 4m 12s

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

FAILURE: Build failed with an exception.

  • What went wrong: Execution failed for task ':app:compileDebugJavaWithJavac'.

    Could not find tools.jar. Please check that C:\Program Files (x86)\Java\jre1.8.0_271 contains a valid JDK installation.

  • 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 4m 12s

at checkExecSyncError (child_process.js:635:11)
at execFileSync (child_process.js:653:15)
at runOnAllDevices (C:\Users\junio\projeto\Android_Studio\Instalura\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:74:39)
at buildAndRun (C:\Users\junio\projeto\Android_Studio\Instalura\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:158:41)
at C:\Users\junio\projeto\Android_Studio\Instalura\node_modules\@react-native-community\cli-platform-android\build\commands\runAndroid\index.js:125:12
at processTicksAndRejections (internal/process/task_queues.js:97:5)
at async Command.handleAction (C:\Users\junio\projeto\Android_Studio\Instalura\node_modules\@react-native-community\cli\build\cliEntry.js:160:7)

você rodou o comando "choco install -y nodejs.install python2 jdk8" ?

eu não rodei esse comando pelo motivo já tenho instalado no meu PC será como pode ser isso?