# An error occurred when executing task 'NpmInstallAndRunBuild'

**URL:** <https://community.jenkins.io/t/an-error-occurred-when-executing-task-npminstallandrunbuild/18456>\
**Category:** Using Jenkins\
**Created:** [August 22, 2024, 9:59am UTC](https://community.jenkins.io/t/an-error-occurred-when-executing-task-npminstallandrunbuild/18456 "2024-08-22T09:59:02Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jenkinsheahache](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jenkinsheahache](https://community.jenkins.io/u/jenkinsheahache)\
**Post date:** [August 22, 2024, 9:59am UTC](https://community.jenkins.io/t/an-error-occurred-when-executing-task-npminstallandrunbuild/18456/1 "2024-08-22T09:59:02Z")

</div>

Hi everyone,  
my Dev reports that his project used to work fine and when we run it as a logged-in user on the server it works ok.

having him an error message  
NpmInstallAndRunBuild **14:17:46** ======================================== **14:17:46** An error occurred when executing task ‘NpmInstallAndRunBuild’. **14:17:46** Error: One or more errors occurred. **14:17:46** Npm: Could not locate executable.

full log here.  
14:17:34 Running as SYSTEM  
14:17:34 [EnvInject] - Loading node environment variables.  
14:17:34 Building on the built-in node in workspace C:\JK\ApsWebUi  
14:17:34 The recommended git tool is: NONE  
14:17:34 using credential 828dc18e-3f82-4126-afbe-0c9337fb403d  
14:17:34 \> C:\Program Files\Git\cmd\git.exe rev-parse --resolve-git-dir C:\JK\ApsWebUi.git # timeout=10  
14:17:34 Fetching changes from the remote Git repository

14:17:34 \> C:\Program Files\Git\cmd\git.exe --version # timeout=10  
14:17:34 \> git --version # ‘git version 2.46.0.windows.1’  
14:17:34 using GIT\_ASKPASS to set credentials Cashplus Github

14:17:36 \> C:\Program Files\Git\cmd\git.exe rev-parse “bd60476d85db164e9953f999a7f09bd06ecb9d79^{commit}” # timeout=10  
14:17:36 Checking out Revision bd60476d85db164e9953f999a7f09bd06ecb9d79 (detached)  
14:17:36 \> C:\Program Files\Git\cmd\git.exe config core.sparsecheckout # timeout=10  
14:17:36 \> C:\Program Files\Git\cmd\git.exe checkout -f bd60476d85db164e9953f999a7f09bd06ecb9d79 # timeout=10  
14:17:36 Commit message: “Merge pull request #1222 from cashplus-uk/bugfix/DIGI-4533”  
14:17:36 First time build. Skipping changelog.  
14:17:36 [ApsWebUi] $ powershell.exe -NoProfile -NonInteractive -ExecutionPolicy Bypass -File C:\Users\APSSVC~1.CI\AppData\Local\Temp\jenkins17198005603342157359.ps1  
14:17:37 Preparing to run build script…  
14:17:38 Running build script…  
14:17:38 The ‘tool’ directive is attempting to install the ‘OctopusTools’ package  
14:17:38 without specifying a package version number.  
14:17:38 More information on this can be found at [Redirected](https://cakebuild.net/docs/tutorials/pinning-cake-version)  
14:17:38 It’s not recommended, but you can explicitly override this warning  
14:17:38 by configuring the Skip Package Version Check setting to true  
14:17:38 (i.e. command line parameter “–settings\_skippackageversioncheck=true”,  
14:17:38 environment variable “CAKE\_SETTINGS\_SKIPPACKAGEVERSIONCHECK=true”,  
14:17:38 read more about configuration at [Redirected](https://cakebuild.net/docs/fundamentals/configuration))  
14:17:40 The ‘tool’ directive is attempting to install the ‘OpenCover’ package  
14:17:40 without specifying a package version number.  
14:17:40 More information on this can be found at [Redirected](https://cakebuild.net/docs/tutorials/pinning-cake-version)  
14:17:40 It’s not recommended, but you can explicitly override this warning  
14:17:40 by configuring the Skip Package Version Check setting to true  
14:17:40 (i.e. command line parameter “–settings\_skippackageversioncheck=true”,  
14:17:40 environment variable “CAKE\_SETTINGS\_SKIPPACKAGEVERSIONCHECK=true”,  
14:17:40 read more about configuration at [Redirected](https://cakebuild.net/docs/fundamentals/configuration))  
14:17:40 The ‘tool’ directive is attempting to install the ‘vswhere’ package  
14:17:40 without specifying a package version number.  
14:17:40 More information on this can be found at [Redirected](https://cakebuild.net/docs/tutorials/pinning-cake-version)  
14:17:40 It’s not recommended, but you can explicitly override this warning  
14:17:40 by configuring the Skip Package Version Check setting to true  
14:17:40 (i.e. command line parameter “–settings\_skippackageversioncheck=true”,  
14:17:40 environment variable “CAKE\_SETTINGS\_SKIPPACKAGEVERSIONCHECK=true”,  
14:17:40 read more about configuration at [Redirected](https://cakebuild.net/docs/fundamentals/configuration))  
14:17:44  
14:17:44 ========================================  
14:17:44 CheckVersion  
14:17:44 ========================================  
14:17:44  
14:17:44 ========================================  
14:17:44 CreateFolders  
14:17:44 ========================================  
14:17:44 Creating folders for test results and reports  
14:17:44  
14:17:44 ========================================  
14:17:44 Restore  
14:17:44 ========================================  
14:17:44 NuGet restoring.\Main\APS.Web.UI.sln  
14:17:45 MSBuild auto-detection: using msbuild version ‘16.11.2.50704’ from ‘C:\Program Files (x86)\Microsoft Visual Studio\2019\Professional\MSBuild\Current\bin’.  
14:17:46 All packages listed in packages.config are already installed.  
14:17:46  
14:17:46 ========================================  
14:17:46 SetVersion  
14:17:46 ========================================  
14:17:46 Updating .\Main\Host\Properties\AssemblyInfo.cs to version 4.0.62  
14:17:46  
14:17:46 ========================================  
14:17:46 NpmInstallAndRunBuild  
14:17:46 ========================================  
14:17:46 An error occurred when executing task ‘NpmInstallAndRunBuild’.  
14:17:46 Error: One or more errors occurred.  
14:17:46 Npm: Could not locate executable.  
14:17:46 Build step ‘PowerShell’ marked build as failure  
14:17:46 [htmlpublisher] Archiving HTML reports…  
14:17:46 [htmlpublisher] Archiving at BUILD level C:\JK\ApsWebUi\Build\reports\OpenCoverReport to C:\Program Files (x86)\Jenkins\jobs\Digital\jobs\Web.UI\jobs\develop\builds\62\htmlreports\OpenCover\_20Report  
14:17:46 [htmlpublisher] Copying recursive using current thread  
14:17:47 INFO: Processing MSTest-Version N/A (default)  
14:17:47 INFO: [MSTest-Version N/A (default)] - 1 test report file(s) were found with the pattern ‘\Build\testresults\*.trx’ relative to ‘C:\JK\ApsWebUi’ for the testing framework ‘MSTest-Version N/A (default)’.  
14:17:47 ERROR: Step ‘Publish xUnit test result report’ failed: Test reports were found but not all of them are new. Did all the tests run?  
14:17:47 \* C:\JK\ApsWebUi\Build\testresults\TestResults.trx is 6 days 21 hr old  
14:17:47  
14:17:47 Finished: FAILURE

---

<div class="post-metadata">

**Author:** ![jenkinsheahache](https://avatars.discourse-cdn.com/v4/letter/j/46a35a/32.png) [@jenkinsheahache](https://community.jenkins.io/u/jenkinsheahache)\
**Post date:** [August 22, 2024, 2:17pm UTC](https://community.jenkins.io/t/an-error-occurred-when-executing-task-npminstallandrunbuild/18456/2 "2024-08-22T14:17:21Z")

</div>

problem solved. just rebooted the server
