[#3 Troubleshoot] WorkflowScript: 5: Tool type "nodejs" does not have an install of "NodeJS 18" configured
saya menemukan error lagi
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 "NodeJS 18.17.1"? @ line 5, column 12.
Β Β Β Β nodejs 'NodeJS 18'
apakah di jenkins files harus dirubah?
β Ya, betul sekali β error tersebut menunjukkan bahwa nama tool "NodeJS 18" yang kamu pakai di Jenkinsfile tidak cocok 100% dengan nama yang dikonfigurasi di Jenkins UI.
π Penjelasan Error:
Tool type "nodejs" does not have an install of "NodeJS 18" configured - did you mean "NodeJS 18.17.1"?
Jenkins mendeteksi bahwa kamu mungkin salah tulis nama tool-nya, dan memberi saran did you mean "NodeJS 18.17.1"?
.
β Solusi
βοΈ Ubah Jenkinsfile sesuai nama di Jenkins UI
Buka kembali Jenkins:
-
Manage Jenkins β Global Tool Configuration β NodeJS
-
Cek nama tool yang kamu buat, misalnya:
NodeJS 18.17.1
Lalu, di file Jenkinsfile
, ubah bagian ini:
tools {
nodejs 'NodeJS 18.17.1' // Ubah ke nama yang sama persis!
}
π Harus 100% sama persis termasuk spasi, huruf besar-kecil, titik versi, dsb.
π Aturan Umum:
Nama di Jenkins UI | Yang harus ditulis di Jenkinsfile |
---|---|
NodeJS 18.17.1 |
nodejs 'NodeJS 18.17.1' |
node18 |
nodejs 'node18' |
default |
nodejs 'default' |
β Atau Solusi Alternatif (Lebih Sederhana)
Jika kamu tidak ingin tergantung dengan nama tool, hapus block tools {}
, dan pastikan node
dan npm
sudah tersedia di server Jenkins:
pipeline {
agent any
stages {
stage('Install deps') {
steps {
sh 'npm ci'
sh 'npx playwright install --with-deps'
}
}
stage('Test') {
steps {
sh 'npm test'
}
}
}
}
β Kesimpulan
-
Ya, nama di
Jenkinsfile
harus cocok 100% dengan yang kamu konfigurasi di Jenkins UI. -
Ubah jadi
'NodeJS 18.17.1'
sesuai saran error. -
Atau hilangkan saja
tools
block kalau sudah installnode/npm
secara manual di server.
No Comments