'Can't Switch to Windows Latest Agent in Azure Pipeline. Gives error gyp ERR! This is a bug in `node-gyp`

pool: name: Azure Pipelines demands: npm

#Your build pipeline references an undefined variable named ‘Parameters.solution’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972 #Your build pipeline references an undefined variable named ‘Parameters.ArtifactName’. Create or edit the build pipeline for this YAML file, define the variable on the Variables tab. See https://go.microsoft.com/fwlink/?linkid=865972

steps:

  • task: NuGetToolInstaller@0 displayName: 'Use NuGet 4.4.1' inputs: versionSpec: 4.4.1

  • task: NuGetCommand@2 displayName: 'NuGet restore' inputs: restoreSolution: '$(Parameters.solution)' feedsToUse: config nugetConfigPath: Nuget.config

  • task: Npm@1 displayName: 'npm custom' inputs: command: custom verbose: false customCommand: 'cache clean --force'

  • task: Npm@1 displayName: 'npm custom' inputs: command: custom verbose: false customCommand: 'i --unsafe-perm node-sass'

  • task: Npm@1 displayName: 'npm custom' inputs: command: custom verbose: false customCommand: 'install run-sequence'

  • task: NodeTool@0 displayName: 'Use Node 6.x'

  • task: Npm@1 displayName: 'npm install' inputs: verbose: false

  • task: gulp@0 displayName: 'gulp CI-Build' inputs: targets: 'CI-Build'

  • task: ArchiveFiles@2 displayName: Output inputs: rootFolderOrFile: output includeRootFolder: false

  • task: PublishBuildArtifacts@1 displayName: 'Publish Artifact: drop' inputs: ArtifactName: '$(Parameters.ArtifactName)' condition: succeededOrFailed()

It is giving the error as below:

3675 error gyp ERR! cwd D:\a\1\s\node_modules\gulp-sass\node_modules\node-sass 3675 error gyp ERR! node -v v16.13.2 3675 error gyp ERR! node-gyp -v v3.8.0 3675 error gyp ERR! This is a bug in node-gyp. 3675 error gyp ERR! Try to update node-gyp and file an Issue if it does not help: 3675 error gyp ERR! https://github.com/nodejs/node-gyp/issues 3675 error Build failed with error code: 7 3676 verbose exit 1

I have tried different version of Node like Node11.x & Node 13.x But can't compile the Build. Please help !



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source