How do I run a gradle task that uses npm in Intellij - node.js

I have a a project that I use the gradle-node-plugin to run npm install. When I run from the command line, everything works fine. When I run from Intellij I get...
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':npmInstall'.
> A problem occurred starting process 'command 'npm''
* 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 15s
2 actionable tasks: 2 executed
Cause: error=2, No such file or directory
1:17:15 PM: Task execution finished 'bootRun'.
Seems to be related to the Gradle Daemon running because sometime IJ causes it to get hosed on the terminal so I have to kill it before it will work again.

Related

how i can fix this errors in android studio kotlin?

that doesn't work anyOne can help me?
Executing tasks: [:app:assembleDebug] in project C:\Users\ABDERRAHIM\Downloads\Compressed\android-studio-ide-202.7188722-windows\TipTime
FAILURE: Build completed with 2 failures.
1: Task failed with an exception.
Where:
Build file 'C:\Users\ABDERRAHIM\Downloads\Compressed\android-studio-ide-202.7188722-windows\TipTime\app\build.gradle' line: 5
What went wrong:
A problem occurred evaluating project ':app'.
Could not find method buildFeatures() for arguments [build_edslfr8cpuhvllawup55ot91a$_run_closure1#4bc52b03] on project ':app' of type org.gradle.api.Project.
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.
==============================================================================
2: Task failed with an exception.
What went wrong:
A problem occurred configuring project ':app'.
compileSdkVersion is not specified. Please add it to build.gradle
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
Could you update with the entire error log here? Try the below command in terminal or refer to this question
gradlew assembleDebug --stacktrace
Also, include the build.gradle file under the App directory.

I create new app in flutter with flutter create AppName in vs code terminal it worked but when i try flutter run it shows this error message

FAILURE: Build failed with an exception.
What went wrong:
Execution failed for task ':app:processDebugResources'.
A failure occurred while executing com.android.build.gradle.internal.tasks.Workers$ActionFacade
Android resource linking failed
AAPT: error: failed writing to 'C:\Users\Mii_Ranna\Desktop\vs test\projectname\build\app\intermedias invalid. (13).
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log o
Get more help at https://help.gradle.org
BUILD FAILED in 3m 1s
Running Gradle task 'assembleDebug'...
Running Gradle task 'assembleDebug'... Done 190.1s
The build failed likely due to AndroidX incompatibilities in a plugin. The tool is about to try using Je
Building plugin integration_test...
Running Gradle task 'assembleAarRelease'...
Running Gradle task 'assembleAarRelease'... Done 9.2s
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':compileReleaseAidl'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or by setting ty setting tpath in your project's local properties file at 'C:\src\flutter\packages\integration_test\anhe sdk.dir path in your project's local properties file at 'C:\src\flutter\packages\integrat hion_test\an
droid\local.properties'.
Try: o
FAILURE: Build failed with an exception.
What went wrong:
Could not determine the dependencies of task ':compileReleaseAidl'.
SDK location not found. Define location with an ANDROID_SDK_ROOT environment variable or b
y setting the sdk.dir path in your project's local properties file at 'C:\src\flutter\packag
es\integration_test\android\local.properties'.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to ge
t more log output. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 6s
Exception: The plugin integration_test could not be built due to the issue above.
Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log o
utput. Run with --scan to get full insights.
Get more help at https://help.gradle.org
BUILD FAILED in 6s
Exception: The plugin integration_test could not be built due to the issue above.
Make sure you have Androidx enabled.
android.useAndroidX=true
Make sure the classpath is set properly.
classpath 'com.android.tools.build:gradle:3.5.0'

Gradle task assembleDebug failed in flutter

I encountered this issue trying to run flutter. This happened when I cloned a project from GitHub and then I tried to run its dependency, which didn't run. So what I did was start the project again and typed in the same code base. I saw then this came up:
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:checkDebugDuplicateClasses'.
> Could not resolve all files for configuration ':app:debugRuntimeClasspath'.
> Could not download flutter_embedding_debug.jar (io.flutter:flutter_embedding_debug:1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408)
> Could not get resource 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408/flutter_embedding_debug-1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408.jar'.
> Could not GET 'http://download.flutter.io/io/flutter/flutter_embedding_debug/1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408/flutter_embedding_debug-1.0.0-af51afceb8886cc11e25047523c4e0c7e1f5d408.jar'.
> Connection reset
* 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 16s
Finished with error: Gradle task assembleDebug failed with exit code 1

Flutter Error running Gradle: Exit code 1 (Ubuntu 18.04 LTS)

My error in flutter run
SO: Ubuntu 18.08 LTS
flutter run
Launching lib/main.dart on moto g 6 play in debug mode...
Initializing gradle... 0,7s
Resolving dependencies...
* Error running Gradle:
Exit code 1 from: /home/leonardo/Github/apps-with-flutter/contador_de_pessoas/android/gradlew app:properties:
Starting a Gradle Daemon (subsequent builds will be faster)
Project evaluation failed including an error in afterEvaluate {}. Run with --stacktrace for details of the afterEvaluate {} error.
FAILURE: Build failed with an exception.
* Where:
Build file '/home/leonardo/Github/apps-with-flutter/contador_de_pessoas/android/app/build.gradle' line: 25
* What went wrong:
A problem occurred evaluating project ':app'.
> Could not resolve all files for configuration 'classpath'.
> Could not find lint-gradle-api.jar (com.android.tools.lint:lint-gradle-api:26.1.2).
Searched in the following locations:
https://jcenter.bintray.com/com/android/tools/lint/lint-gradle-api/26.1.2/lint-gradle-api-26.1.2.jar
* 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
Please review your Gradle project setup in the android/ folder.
Executing ./android/gradlew return ok!
leonardo#cintra:~/Github/apps-with-flutter/contador_de_pessoas$ ./android/gradlew
Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details
> Task :help
Welcome to Gradle 4.4.
To run a build, run gradlew <task> ...
To see a list of available tasks, run gradlew tasks
To see a list of command-line options, run gradlew --help
To see more detail about a task, run gradlew help --task <task>
BUILD SUCCESSFUL in 2s
1 actionable task: 1 executed
Please, help me!
Resolved!
I followed the orientation of the #M.Ricciut https://stackoverflow.com/a/52947028/6899896
it worked! But I gave this error (You have not accepted the license agreements of the following SDK components) and solved it
Flutter itself is the issue. For some of the discussion about it: https://github.com/flutter/flutter/pull/23397
In short, following Mahi-K from the above link, you have to edit $flutterRoot/packages/flutter_tools/gradle/flutter.gradle
buildscript {
repositories {
google()
jcenter()
maven {
url 'https://dl.google.com/dl/android/maven2'
}
}
dependencies {
classpath 'com.android.tools.build:gradle:3.2.1'
}
}
In the gradle wrapper properties gradle/wrapper/gradle-wrapper.properties you may also have to change it to 4.6 or above
distributionUrl=https\://services.gradle.org/distributions/gradle-4.6-all.zip

NPM Issue while running from jenkins

I am currently facing some issue which are related to gradle/NodeJS. What I did is used Node plugin by writing this in my gradle script:
apply plugin: 'com.moowork.node'
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:0.12'
}
now when I try to run install npm command from terminal(CentOS) by running:
gradle npmInstall
it is running perfectly fine and installing all the required packages whereas when I run the same command from Jenkins (Jenkins installed in centos), I am getting following error msg:
:npmInstall FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':npmInstall'.
> A problem occurred starting process 'command 'npm''
* Exception is:
org.gradle.api.tasks.TaskExecutionException: Execution failed for task
':npmInstall'.
at org.gradle.api.internal.tasks.execution.ExecuteActionsTaskExecuter.executeActions(ExecuteActionsTaskExecuter.java:69)
Caused by: org.gradle.process.internal.ExecException: A problem occurred starting process 'command 'npm''
at org.gradle.process.internal.DefaultExecHandle.setEndStateInfo(DefaultExecHandle.java:197)
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'npm'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
Can somebody please help me with is. I am not getting what Wrong I am doing.
I am also getting the same error msg if try to run following command:
gradle npm_run_build_prod
whereas the same list of commands are working for my local windows jenkins.
My issue was resolved on the Gradle help forum. The solution is to download Node.js during the build by adding this to build.gradle:
node {
download = true
version='9.2.0'
}

Resources