NPM Issue while running from jenkins - node.js

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'
}

Related

Android app not executed . Please help me out from this problem

During Rebuild Project following error message shown in Logcat
Task :app:dataBindingGenBaseClassesDebug FAILED
no info log is passed. There are no resources?
Execution failed for task ':app:dataBindingGenBaseClassesDebug'.
Parameter 'directory' is not a directory
Use this command
./gradlew assembleDebug --rerun-tasks

Gradle Problem When Importing Flutter Project From Git

I imported a Flutter Project from this git repo: https://github.com/gligerglg/geodropin (website: https://itsallwidgets.com/geodropin) by copying the HTTPS, then go to Android Studio -> Check out Project from Version Control -> Git. When I open the project and try to run, this error appear:
* Error running Gradle:
ProcessException: Process "/Users/phuctruong/AndroidStudioProjects/geodropin/android/gradlew" exited abnormally:
FAILURE: Build failed with an exception.
* Where:
Build file '/Users/phuctruong/AndroidStudioProjects/geodropin/android/app/build.gradle' line: 45
* What went wrong:
A problem occurred evaluating project ':app'.
> For input string: "1.01"
* 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 0s
Command: /Users/phuctruong/AndroidStudioProjects/geodropin/android/gradlew app:properties
Finished with error: Please review your Gradle project setup in the android/ folder.
I assume this has something to do with my gradle version and the project's gradle version? I'm a newbie to Flutter so my understanding of gradle is limited. When I check gradle-wrapper.property it said i'm using gradle 4.10.2
Thanks for helping.
Check out the 16th line of app/build.gradle you will see that the number in a string is of float type. VersionCode should always be integer. Check this out https://developer.android.com/studio/publish/versioning
You can remove this error by just changing it to positive integer value like this :
flutterVersionCode = '1'
Now this problem is resolved but however you will get another error related to androidX but thats different question.
Error would be :
BUILD FAILED in 10s
******************************************************************************************* The Gradle failure may have been because of AndroidX incompatibilities
in this Flutter app. See link for more information on
the problem and how to fix it.
******************************************************************************************* Finished with error: Gradle task assembleDebug failed with exit code 1
For this issue you need to migrate the project to androidX,
add it in android/gradle.properties:
android.useAndroidX=true
android.enableJetifier=true
Or if its already there, Check this migration docs for more info.
Or nothing works, you can ask another question.

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

How do I run a gradle task that uses npm in Intellij

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.

Running JHipster gradlew fails on ':bower' task

I am trying to run ./gradlew in jhipster project and getting next error with ':bower' task:
:cleanResources
:bootBuildInfo
:bower FAILED
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':bower'.
> A problem occurred starting process 'command 'bower''
.......
Caused by: net.rubygrapefruit.platform.NativeException: Could not start 'bower'
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:27)
at net.rubygrapefruit.platform.internal.WrapperProcessLauncher.start(WrapperProcessLauncher.java:36)
at org.gradle.process.internal.ExecHandleRunner.run(ExecHandleRunner.java:68)
... 2 more
Caused by: java.io.IOException: Cannot run program "bower" (in directory "/Users/vovkvlad/coding/learning/Java/jHipProj"): error=2, No such file or directory
at net.rubygrapefruit.platform.internal.DefaultProcessLauncher.start(DefaultProcessLauncher.java:25)
... 4 more
I have seen similar problems on stackoverflow:
Running JHipster Gradle task from Intellij IDEA
jhipster - error executing task :bower
But first link complains only about failure in IntelliJ (and in my case the same error occurs in the terminal)
And second link gives pretty strange answer with removing node which seems strange to me, and may be not applicable since 2 years have past.
So, do anyone have a key to what am I doing wrong?
I will be grateful for any kind of help/hint.
Thanks in advance for help!
EDIT: I have bower installed globally, so that it can be found under one of the paths in $PATH. And bower is recognized from the terminal.
I was having this same issue. I was able to fix it by stopping the gradle daemon using ./gradlew --stop. Here is a link to a post where I found the solution.
i got the same issue, and fixed it with command below.
gradle --stop
In my case, i use Eclipse with Buildship plugin, it starts a Grade Daemon to build project by itself, and the classpath of NodeJS & Bower is difference when running application in terminal.

Resources