[#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'
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:
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 isiJenkinsfile
Kalau kamu tidak ingin pakai block tools { nodejs '...' }, kamu juga bisa secara manual panggil Node.js di agent Jenkins (kalau sudah pre-installed di server). Tapi yang kamu lakukan sekarang sudah paling ideal untuk portability dan automation.
Kalau butuh saya bantu modifikasi Jenkinsfile agar bisa fallback jika NodeJS tool belum diset, tinggal bilang.