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

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)

> programas-projetos-web-app@0.0.0 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.

About this issue

  • Original URL
  • State: closed
  • Created 5 years ago
  • Reactions: 5
  • Comments: 25 (4 by maintainers)

Most upvoted comments

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.

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.

@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?

@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 npm@6.11.1 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.

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