Azure-pipelines-tasks: npm version 6.11.0 - 'find_dp0' is not recognized as an internal or external command,

Created on 23 Aug 2019  路  25Comments  路  Source: microsoft/azure-pipelines-tasks

Type: Bug
Enter Task Name:
Task : npm
Task Version : 1.156.1

Environment

  • Server - Azure Pipelines

Issue Description

image

I had a task that runs a custom npm commands. And worked perfect until the Hosted Agent (Hosted Windows 2019 with VS2019) upgrade the npm version from "6.10.3" to "6.11.0"

Task logs with error ("6.11.0")

##[section]Starting: ProgramasProjetosWebApp - npm build
==============================================================================
Task         : npm
Description  : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
Version      : 1.156.1
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/package/npm
==============================================================================
SYSTEMVSSCONNECTION exists true
SYSTEMVSSCONNECTION exists true
[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd --version"
6.11.0
[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd config list"
; cli configs
metrics-registry = "https://registry.npmjs.org/"
scope = ""
user-agent = "npm/6.11.0 node/v10.16.3 win32 x64"

; environment configs
cache = "C:\\npm\\cache"
prefix = "C:\\npm\\prefix"
userconfig = "d:\\a\\1\\npm\\31417.npmrc"

; builtin config undefined

; node bin location = C:\Program Files\nodejs\node.exe
; cwd = d:\a\1\s\src\ProgramasProjetos\ProgramasProjetosWebApp
; HOME = C:\Users\VssAdministrator
; "npm config ls -l" to show all defaults.

[command]C:\windows\system32\cmd.exe /D /S /C "C:\npm\prefix\npm.cmd run build-prod"
'find_dp0' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:638
    throw err;
    ^

Error: Cannot find module 'd:\@angular\cli\bin\ng'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

> [email protected] build-prod d:\a\1\s\src\ProgramasProjetos\ProgramasProjetosWebApp
> ng build --prod --base-href=/programasprojetos/ --deploy-url=/programasprojetos/

##[section]Finishing: ProgramasProjetosWebApp - npm build

again, yesterday worked perfect, i did not change nothing, and today i got this problem.

Comparing both logs, i saw the diference, the npm version.

bug route

Most helpful comment

I got the same error when I tried a CLI task. I could get npm updated using npm-windows-upgrade in a PowerShell task. I'm testing the rest of the build now.

Edit: My build was successful after using the above mentioned npm update method (npm-windows-upgrade tool). Below is the PowerShell task configuration I used:

- powershell: |
          Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
          npm install --global --production npm-windows-upgrade
          npm-windows-upgrade --npm-version latest
   displayName: 'Upgrade npm'

Edit 2: Updated formatting.

All 25 comments

Hi,

Thanks for reaching out to us. It appears that the issue is with npm v6.11.0, there is a similar issue report here: https://npm.community/t/6-11-0-npm-looking-for-executable-packages-in-root-c/9574 . Additionally, it looks like npm has already released the fix for this in npm v6.11.1 based on the solution to the issue report.

Since this is not an issue with the task, i would suggest updating your npm version or downgrading it and trying again.

Please let me know if this fixes your issue.

I'm using the Hosted Agent (Hosted Windows 2019 with VS2019).
I added a task "Use Node 12.6" that user npm "6.9.0". This task runs, but the next one, continue using npm "6.11.0"

How i change de npm version on Hosted Agent (Hosted Windows 2019 with VS2019)?

@penihel while we make the fix to the hosted agents, can you please add a command line task before the npm task and run:

npm install -g [email protected]
npm run prepare - successful

This should update your npm globally and npm task should use 6.11.1. We have forwarded this issue to the team which manages hosted agents.

@shubham90 thanks for the temporary quick fix. Any idea when the hosted agents will get fixed for this?

@shubham90 we tried this fix, but are getting the following error. Running this through a command-line task or a basic script task had the same results.

[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a_temp\30c309bb-3b4f-499d-a5c5-36d807c79a95.cmd""

C:\npm\prefix\npm -> C:\npm\prefix\node_modules\npm\bin\npm-cli.js
C:\npm\prefix\npx -> C:\npm\prefix\node_modules\npm\bin\npx-cli.js

  • [email protected]
    updated 2 packages in 31.661s
    'npm-cli.js" install -g [email protected]' is not recognized as an internal or external command,
    operable program or batch file.

[error]Cmd.exe exited with code '9009'.

[section]Finishing: npm 6.11.1s

@shubham90 We're also getting the same error as kylemorton5770

@shubham90 Same as @brunk01 and @kylemorton5770

I got the same error when I tried a CLI task. I could get npm updated using npm-windows-upgrade in a PowerShell task. I'm testing the rest of the build now.

Edit: My build was successful after using the above mentioned npm update method (npm-windows-upgrade tool). Below is the PowerShell task configuration I used:

- powershell: |
          Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
          npm install --global --production npm-windows-upgrade
          npm-windows-upgrade --npm-version latest
   displayName: 'Upgrade npm'

Edit 2: Updated formatting.

I had the same problem

##[section]Starting: Command Line Script - NPM
==============================================================================
Task         : Command line
Description  : Run a command line script using Bash on Linux and macOS and cmd.exe on Windows
Version      : 2.151.2
Author       : Microsoft Corporation
Help         : https://docs.microsoft.com/azure/devops/pipelines/tasks/utility/command-line
==============================================================================
Generating script.
========================== Starting Command Output ===========================
##[command]"C:\windows\system32\cmd.exe" /D /E:ON /V:OFF /S /C "CALL "d:\a\_temp\96ad13a9-dc1c-4e27-84ea-5ef47b40cff0.cmd""
Atualizando o npm
C:\npm\prefix\npm -> C:\npm\prefix\node_modules\npm\bin\npm-cli.js
C:\npm\prefix\npx -> C:\npm\prefix\node_modules\npm\bin\npx-cli.js
+ [email protected]
updated 3 packages in 23.543s
'npm-cli.js" install npm@latest -g' is not recognized as an internal or external command,
operable program or batch file.
##[error]Cmd.exe exited with code '9009'.
##[section]Finishing: Command Line Script - NPM

I got the same error when I tried a CLI task. I could get npm updated using npm-windows-upgrade in a PowerShell task. I'm testing the rest of the build now.

This worked for us. Thank you.

I got the same error when I tried a CLI task. I could get npm updated using npm-windows-upgrade in a PowerShell task. I'm testing the rest of the build now.

Can confirm this does update your npm on the build agent to 6.11.2. The 'find-dp0' error persisted in our build though. We're now trying this same method, but rolling back to 6.10.3

I got the same error when I tried a CLI task. I could get npm updated using npm-windows-upgrade in a PowerShell task. I'm testing the rest of the build now.

This worked for us. Thank you.

This also worked for us.

rolling back to 6.10.3 resulted in the build step failing -

_You wanted to install npm 6.10.3, but we could not confirm that the installation succeeded.
Please consider reporting your trouble to https://aka.ms/npm-issues._

@Shobhit1 will the fix that was merged up in this issue apply to Azure pipelines, specifically the issue we're seeing in this thread?

If so, is there a timeline on when it will reach production?

@kylemorton5770 we're still looking into a fix that can be applied generally to the Azure Pipelines hosted agents. As soon as we have a fix and ETA I'll post here.

@Shobhit1 will the fix that was merged up in this issue apply to Azure pipelines, specifically the issue we're seeing in this thread?

If so, is there a timeline on when it will reach production?

Hey @kylemorton5770; the fix was specific for our repo and build in Accessibility-insights-web. It doesn't fix the issue with the azure task or azure pipeline.
I guess me mentioning this issue in my PR in our repo linked it here; which is confusing.

@alepauly Hi, we see this issue is affecting our azure builds. Can you please let me know when do you apply the fix for Azure Pipelines hosted agents?

This started affecting us today. The last build that ran successfully was npm version 6.10.3 and the first one that failed was 6.11.0.

However, running the script to downgrade it to 6.10.3 or upgrade to 6.11.1 is not solving the problem. I've verified that it is properly changing the version by outputting npm --version just before running my gulp command which is failing.

Please help!!

@wpatter6 How are you upgrading to 6.11.1? In our tests the following upgraded npm and allowed the builds to work as expected:

  npm install -g npm-windows-upgrade
  npm-windows-upgrade -v 6.11.1

Is that what you tried?

Yes, @alepauly , I'm using the powershell script posted by milinda above that uses that npm-windows-upgrade package. It does appear to properly change the version, but I'm still getting the find_dp0 error on our gulp build command. I tried with both 6.11.1 and 6.10.3.

This started affecting us yesterday and is preventing us from doing a yarn install and is failing all of our builds, blocking deployments, etc. Any details on working around it or an ETA on when the build agent will be fixed would be great.

I had this issue as well, and was able to get our builds going again using:
npm install -g npm-windows-upgrade
npm-windows-upgrade -v 6.11.2

The issue I actually was having appears to have been occurring because it seems the version change on NPM caused the server to lose our global gulp install. So running npx gulp build instead of just gulp build fixed it. Alternatively we could have added npm install -g gulp as a step in the build process. Thanks for looking into this @alepauly

Since a workaround that addresses all of our customers is proving tricky, we've started rolling back the windows-2019-vs2019 image to the previous version that didn't have the issue with npm 6.11.0. That rollback should take a few hours to complete. Note that the ImageVersion environment variable can be used to check what version of the image your build is running on. ImageVersion = 157.1 has npm 6.11.0 and we're reverting to ImageVersion = 156.2. Thank you everyone for the reports and workaround suggestions! As soon as node-lts has the fixed npm packaged in we'll roll out a new image. We'll report here once the rollback is complete.

The rollback is finished now and we have verified that the issue is not happening any more. We apologize for the inconvenience. Please do let us know if you're still hitting any issue.

Was this page helpful?
0 / 5 - 0 ratings