Problem when using Jenkins NodeJs pipeline plugin

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Problem when using Jenkins NodeJs pipeline plugin

John Doe
Hey,

I'm trying to get nodejs plugin working in pipeline, here is example code:
pipeline {
agent any
environment {
TESTGLOBALVARIABLE = 'TEST'
}
tools {
nodejs '7.7.3'
}


jenkins gives me this error:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: Invalid tool type "nodejs". Valid tool types: [ant, hudson.tasks.Ant$AntInstallation, org.jenkinsci.plugins.docker.commons.tools.DockerTool, git, hudson.plugins.git.GitTool, go, org.jenkinsci.plugins.golang.GolangInstallation, gradle, hudson.plugins.gradle.GradleInstallation, jdk, hudson.model.JDK, jgit, org.jenkinsci.plugins.gitclient.JGitTool, jgitapache, org.jenkinsci.plugins.gitclient.JGitApacheTool, hudson.plugins.msbuild.MsBuildInstallation, org.jenkinsci.plugins.MsTestInstallation, maven, hudson.tasks.Maven$MavenInstallation, jenkins.plugins.nodejs.tools.NodeJSInstallation, org.jenkinsci.plugins.vs_code_metrics.VsCodeMetricsInstallation] @ line 7, column 9.
           nodejs '7.7.3'
           ^

According to stacktrace nodejs is not recognized and output suggests me to use jenkins.plugins.nodejs.tools.NodeJSInstallation instead, so here is new attempt:

pipeline {
agent any
environment {
TESTGLOBALVARIABLE = 'TEST'
}
tools {
jenkins.plugins.nodejs.tools.NodeJSInstallation '7.7.3'
}

gives me this:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: unexpected token: 7.7.3 @ line 7, column 57.
   dejs.tools.NodeJSInstallation '7.7.3'
                                 ^


Any idea how to get this plugin working in pipeline mode ?

Thank you for any help or suggestions!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/f8fabcb6-1749-4181-96c2-4e92968f171d%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Problem when using Jenkins NodeJs pipeline plugin

Frits van der Holst
I ran into a similar problem using an other external tool. According to the documentation the Tools keyword/step only works for gradle, jvm and maven.
So I wanted to run an external groovy script via the Groovy  tool installer/plugin.
I arrived at this solution:

    environment {
        GROOVY_HOME
= tool name: 'Groovy-2.4.9', type: 'hudson.plugins.groovy.GroovyInstallation'
   
}
    stages
{
        stage
('Run Groovy') {
            steps
{
                bat
"${groovy_home}/bin/groovy <script.name>"
           
}
       
}
   
}
Enter code here...

I did let the Snippet generator generate this
tool name: 'Groovy-2.4.9', type: 'hudson.plugins.groovy.GroovyInstallation'
Enter code here...

Hope this helps.

Frits



On Saturday, July 8, 2017 at 10:49:24 AM UTC+2, John Doe wrote:
Hey,

I'm trying to get nodejs plugin working in pipeline, here is example code:
pipeline {
agent any
environment {
TESTGLOBALVARIABLE = 'TEST'
}
tools {
nodejs '7.7.3'
}


jenkins gives me this error:

org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: Invalid tool type "nodejs". Valid tool types: [ant, hudson.tasks.Ant$AntInstallation, org.jenkinsci.plugins.docker.commons.tools.DockerTool, git, hudson.plugins.git.GitTool, go, org.jenkinsci.plugins.golang.GolangInstallation, gradle, hudson.plugins.gradle.GradleInstallation, jdk, hudson.model.JDK, jgit, org.jenkinsci.plugins.gitclient.JGitTool, jgitapache, org.jenkinsci.plugins.gitclient.JGitApacheTool, hudson.plugins.msbuild.MsBuildInstallation, org.jenkinsci.plugins.MsTestInstallation, maven, hudson.tasks.Maven$MavenInstallation, jenkins.plugins.nodejs.tools.NodeJSInstallation, org.jenkinsci.plugins.vs_code_metrics.VsCodeMetricsInstallation] @ line 7, column 9.
           nodejs '7.7.3'
           ^

According to stacktrace nodejs is not recognized and output suggests me to use jenkins.plugins.nodejs.tools.NodeJSInstallation instead, so here is new attempt:

pipeline {
agent any
environment {
TESTGLOBALVARIABLE = 'TEST'
}
tools {
jenkins.plugins.nodejs.tools.NodeJSInstallation '7.7.3'
}

gives me this:
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 7: unexpected token: 7.7.3 @ line 7, column 57.
   dejs.tools.NodeJSInstallation '7.7.3'
                                 ^


Any idea how to get this plugin working in pipeline mode ?

Thank you for any help or suggestions!

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/887d8572-1cae-4df8-b574-6a8b2fb8cd69%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.