Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

320
Visualizações
Azure DevOps Build pipeline `npm install` failing on node-gyp

We have a CD/CI Azure Devops build pipeline that has started failing for nodejs/node-gyp.

  • error gyp info using node-gyp@3.8.0
  • error gyp info using node@16.13.0 | win32 | x64

Nothing about our build pipeline has changed, the pool we use is:

pool:
  vmImage: 'windows-latest'

Which is still mapped to windows-2019 https://docs.microsoft.com/en-us/azure/devops/pipelines/agents/hosted?view=azure-devops&tabs=yaml.

The pipeline fails when we hit the following task in the YAML file:

- task: Npm@1
  displayName: 'npm install'
  inputs:
    command: 'install'
    workingDir: 'FrontEnd'
    verbose: true

Log file:

error gyp ERR! UNCAUGHT EXCEPTION
error gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT
error gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:282:19)
error gyp ERR! stack     at onErrorNT (node:internal/child_process:477:16)
error gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
error gyp ERR! System Windows_NT 10.0.17763
error gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "D:\\a\\1\\s\\Presentation\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
error gyp ERR! cwd D:\a\1\s\FrontEnd\node_modules\node-sass
error gyp ERR! node -v v16.13.0
error gyp ERR! node-gyp -v v3.8.0
error gyp ERR! This is a bug in `node-gyp`.
error gyp ERR! Try to update node-gyp and file an Issue if it does not help:
error gyp ERR!     <https://github.com/nodejs/node-gyp/issues>
error Build failed with error code: 7
verbose exit 1

##[error]Error: Npm failed with return code: 1
over 4 years ago · Santiago Trujillo
4 Respostas
Responde à pergunta

0

Azure auto updated the version of node it was using, pushing the required version of node-gyp forward too, this lead to all of our builds failing. The versions it pushed to were:

  • npm@8.1.0
  • node@v16.13.0

Add task: NodeTool@0 to set the Node version to the last passed version which for us was:

  • npm@6.14.15
  • node@14.18.1

The end code looks like this:

- task: NodeTool@0
  inputs:
    versionSpec: '14.x'
    
- task: Npm@1
  displayName: 'npm install'
  inputs:
    command: 'install'
    workingDir: 'FrontEnd'
    verbose: true

After re-running the pipeline it works again and produces artefacts.

over 4 years ago · Santiago Trujillo Relatório

0

The issue we had with npm/node versions pointed to node-gyp as the culprit as shown here. If the conflicting versions are not shown under the particular component exception, the npm/node versions are revealed under the user-agent when npm install is running

Under the npm install task the user agent is shown as:

user-agent = "npm/6.14.15 node/v16.13.0 win32 x64"

when running the 'windows-latest' image.

Using the node tool in the previous answer, the above it changes to:

user-agent = "npm/6.14.15 node/v14.18.1 win32 x64"

This question is similar to Azure DevOps Pipeline NPM install task fails with node-gyp build error

over 4 years ago · Santiago Trujillo Relatório

0

For those not using yaml and the classic editor instead:

Node.js tool installer settings

over 4 years ago · Santiago Trujillo Relatório

0

For Classic editor users:

  • Go to Pipelines
  • Click Edit near desired pipline
  • Add Node.js tool installer task before npm install task
  • Version Spec: 14.x
  • Save pipline
over 4 years ago · Santiago Trujillo Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda