Skip to main content

[#1 Troubleshoot] WorkflowScript: 5: Tool type "nodejs" does not have an install of "NodeJS 18" configured

saya menemukan error ini Started by user widianto

Obtained Jenkinsfile from git http://172.16.10.128/widi/playwright.git
org.codehaus.groovy.control.MultipleCompilationErrorsException: startup failed:
WorkflowScript: 5: Tool type "nodejs" does not have an install of "NodeJS 18" configured - did you mean "null"? @ line 5, column 12.
Β  Β  Β  Β nodejs 'NodeJS 18'

Error tersebut menunjukkan bahwa Jenkins tidak menemukan konfigurasi tool dengan nama "NodeJS 18", padahal kamu memanggilnya di Jenkinsfile dengan:

tools {
    nodejs 'NodeJS 18'
}

βœ… Solusi

Kamu harus menambahkan NodeJS 18 ke konfigurasi Jenkins Tools, agar bisa dikenali oleh pipeline.


πŸ”§ Langkah-langkah Tambahkan NodeJS di Jenkins:

1. Masuk ke Jenkins β†’ Manage Jenkins

2. Klik Global Tool Configuration

3. Scroll ke bagian NodeJS

Di situ akan ada form seperti ini:

Field Isi
Name NodeJS 18 ← (harus sama persis dengan yang di Jenkinsfile)
Install automatically βœ… (Centang)
Version Pilih versi NodeJS 18.x (misal 18.17.1 atau terbaru)

Contoh:
contoh nodejs tool config

4. Klik tombol Save di paling bawah


βœ… Setelah Itu:

Kamu bisa ulangi build pipeline kamu:

Build Now

Dan Jenkins sekarang akan:

  • Install NodeJS versi 18.x

  • Jalankan semua perintah npm ci, npx playwright install, dll sesuai isi Jenkinsfile