'npm' is not recognized as an internal or external command, operable program or batch file

Jenkins setup:Jenkins: 2.423
OS: Windows Server 2019 - 10.0
Java: 11.0.15 - Oracle Corporation (Java HotSpot™ 64-Bit Server VM)

apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
bootstrap5-api:5.3.0-1
bouncycastle-api:2.29
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.0.1
cloudbees-folder:6.858.v898218f3609d
commons-lang3-api:3.13.0-62.v7d18e55f51e2
commons-text-api:1.10.0-78.v3e7b_ea_d5a_fe1
config-file-provider:953.v0432a_802e4d2
copyartifact:722.v0662a_9b_e22a_c
credentials:1271.v54b_1c2c6388a_
credentials-binding:631.v861c06d062b_4
display-url-api:2.3.9
echarts-api:5.4.0-5
font-awesome-api:6.4.0-2
git:5.2.0
git-client:4.4.0
github:1.37.3
github-api:1.314-431.v78d72a_3fe4c3
github-branch-source:1734.v8a_ed3a_653490
instance-identity:173.va_37c494ec4e5
ionicons-api:56.v1b_1c8c49374e
jackson2-api:2.15.2-350.v0c2f3f8fc595
jakarta-activation-api:2.0.1-3
jakarta-mail-api:2.0.1-3
javadoc:243.vb_b_503b_b_45537
javax-activation-api:1.2.0-6
javax-mail-api:1.6.2-9
jaxb:2.3.8-1
jjwt-api:0.11.5-77.v646c772fddb_0
jquery3-api:3.7.0-1
jsch:0.2.8-65.v052c39de79b_2
junit:1217.v4297208a_a_b_ce
mailer:463.vedf8358e006b_
matrix-project:808.v5a_b_5f56d6966
maven-plugin:3.23
mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_
mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_
nodejs:1.6.1
okhttp-api:4.11.0-157.v6852a_a_fa_ec11
pipeline-github-lib:42.v0739460cda_c4
pipeline-groovy-lib:704.vc58b_8890a_384
plain-credentials:143.v1b_df8b_d3b_e48
plugin-util-api:3.3.0
saferestart:0.7
scm-api:676.v886669a_199a_a_
script-security:1321.va_73c0795b_923
snakeyaml-api:2.2-111.vc6598e30cc65
ssh-credentials:308.ve4497b_ccd8f4
structs:337.v1b_04ea_4df7c8
token-macro:384.vf35b_f26814ec
trilead-api:2.84.v72119de229b_7
variant:60.v7290fc0eb_b_cd
workflow-api:1291.v51fd2a_625da_7
workflow-cps:3853.vb_a_490d892963
workflow-job:1385.vb_58b_86ea_fff1
workflow-scm-step:415.v434365564324
workflow-step-api:657.v03b_e8115821b_
workflow-support:865.v43e78cc44e0d

Hi,
I have the above Jenkins environment where my front end/back end application JS builds (ReactJS/ Angular JS/node JS) were successfully running till date. All of a sudden I am getting below error. I had safely restarted Jenkins (as found solution online) but it is not working.Please Help.

Error in Console output : "C:\ProgramData\Jenkins.jenkins\workspace\BHP TEST FRONT END>npm install
‘npm’ is not recognized as an internal or external command,
operable program or batch file.

C:\ProgramData\Jenkins.jenkins\workspace\BHP TEST FRONT END>exit 9009
Build step ‘Execute Windows batch command’ marked build as failure
Finished: FAILURE"

Note : I had npm version 8.1.0 and node version 16.13.0 installed via NVM (Windows tool). Even I checked the PATH environment variable.It was ok in the system.

Jenkins was not able to recognize the path of npm. Resolved after configuring the nodeJS path to the SYSTEM PATH environment variable instead of NVM%HOME variable which was provided earlier. Its working now.

Thanks for the feedback, @Victor . :+1: