Azure DevOps failing on "npm install" - azure-devops

We have a CD/CI Azure DevOps build pipeline that stop working all of a sudden today. It has been invoked successfully in our pipeline for months on end.
The component that fails is the "npm install" , it fails with the following error in the verbose log:
I google around and some suggested to run: npm cache clear --force prior to npm install.
I tried that but same error persists.
Then I look up earlier in the log and see the following:
I tried to browse to https://github.com/sass/node-sass/releases/download/v4.12.0/win32-x64-83_binding.node and got the message "Page not found".
I cannot tell if this is related to the root cause why npm fails but it seems to back my assumption that something is not right with "npm install" as of this time of writing (Nov 17, 2020).
Anyone else using Azure DevOps for CD/CI having the same issue?
I look at NPM incident page and see this issue https://status.npmjs.org/incidents/r1tlhscrw3r6 but it should have been fixed.

Recently, a breaking change was made to the default Azure DevOps agent images for the default version of Node.js. It was incremented from 12.x to 14.x.
Breaking changes
Default version of Node.JS on images will be updated
from 12.x to 14.x
Target date
For Windows, Ubuntu images, rollout of this change will
start on 2 November 2020 and will take 3-4 days For MacOS images,
rollout will start on 9 November.
The motivation for the changes
On images, we always install LTS
version of Node.JS by default. On 2020-10-27, Node.JS 14 has become
LTS version. On 2020-11-30, Node.JS 12 will be switched to Maintenance
mode.
Possible impact
If you rely on default Node.JS version and your
project is not compatible to Node.JS 14, it might start to fail
Mitigation ways
Please consider using Node.js Tool Installer task (for Azure DevOps) and
setup-node (for GitHub Actions) to switch back to Node.JS 12.
Switching will take less than a second. Node.JS 12 still will be
available on images along with Node.JS 8, 10.

Based on #Matt's answer, I'll post the fragment of yml you need to fix this:
- task: NodeTool#0
inputs:
versionSpec: '12.x'

For anyone still using the graphical UI rather than YML files, you would add a
"Node.js tool installer" task and configure its version. It would look something like this (where the Version Spec contains the version of node.js you want run):
Also note that it is BEFORE the "npm install" task!!

Related

Unable install Strapi plugin [strapi-plugin-import-content]

I trying to acquire this plugins which available with its GitHub directory
https://github.com/jbeuckm/strapi-plugin-import-content
However, the last command:(not workable)
npm run setup --plugins
It prompt me this:
enter image description here
May I know how could i solve it?
I try "npm cache clean --force" but it still not workable
'npm run setup' was available in Strapi 3.x but as far as I know it is no longer available latest by version 4.x - I guess you are using Strapi 4.x.
https://github.com/jbeuckm/strapi-plugin-import-content was updated 4 years ago so I think it was designed for Strapi 3.x.

How to upgrade Self-hosted action runner?

Self-hosted GitHub actions runner installed on Linux, Windows and Mac systems.
I need to upgrade the runner version to latest on Linux, Windows and MacOS.
How to check the currently installed Runner version?
In runner log and service status side, I can't find the information.
How to upgrade the runner to latest version?
Please help me with information. Thanks in advance.
Go to the self hosted runner directory, list folders, you should see the bin and externals directory with the version suffix bin.2.288.1, externals.2.288.1 - most current should have symlink with full directory. Also you can check version of each component listener, plugin-host,worker in /bin directory json files. There's no need to force updating self hosted runner - it should update automatically to the latest. One scenario in which you will need to update the runners manually is inside docker container - you can use this script:
https://github.com/GarnerCorp/github-actions-runner/blob/cb604618a600bd5174f3dbc8d51d15eee6585c68/scripts/install-runner

How to get VS build agent capabilities without installing the full Visual Studio application?

I've installed the latest VS Build Tools (2022), but my on-prem build agent isn't picking up the VisualStudio-related capabilities. I've been under the impression that we no longer need to install the full application in order to get these capabilities.
An example from this blog post:
I've added all workloads to my offline layout, and I've included them in my installation.
I know this is possible, because earlier I accidentally included Python and VS 2019 Build Tools in my Node.js installation configuration. The VS-related capabilities were found by the agent then.
But I'm trying to get 2022, so I uninstalled 2019.
How can I get the 2022 VS-related capabilities to be installed and detected by my build agent, without installing the full Visual Studio product?
You need to upgrade the agent to a recent enough version. You can download the agent from the azure-pipelines-agent repository's releases page. Or manually specify the capabilities.
You may need to set a special environment flag on the agent to prevent it from automatically being downgraded to whatever version shipped with your version if Azure DevOps Server or Team Foundation Server.
And then you'll also need to install the latest version of the vsbuild/msbuild and vstest tasks
Required agent version
You will need to install the most recent agent from the azure-pipelines-agent repository for it to auto-detect Visual Studio 2022, or alternatively add the capabilities to the agent manually.
You may need to force Azure DevOps Server to not downgrade back to its preferred agent version. You can do so by setting the following environment variable at the system level on your server before launching the agent:
AZP_AGENT_DOWNGRADE_DISABLED=true
These tricks will work for most tasks in the azure-pipelines-tasks repository, as long as it doesn't depend on a UI extension or service connection type that isn't available in your version of Azure DevOps Server.
https://jessehouwing.net/adding-visual-studio-2022-to-azure-devops-server-2020/

Visual studio team services - Octopus does not work after agent update to version 2

Background:
We are using the VSTS to build and Octopus integration to deploy our product. The Octopus step is configured as follows,
Issue
Today VSTS Build was throwing following error,
No supported agent found in pool Default. All agents in this pool are
using a version that is deprecated. Migrate to the latest 2.x version
of agent. For more information, see
https://go.microsoft.com/fwlink/?linkid=851067
As a result, the Agent was updated to the latest version,
After the update the octopus step stopped working with following error,
Then issue seems to be the environment variables are not replaced in the step.
I would like to know if there is a work around to fix this issue.
First, there is 2.* version available, so you can delete the old one and add the new one.
Secondly, use $(Build.BuildNumber) instead in Package Version input box, also for Output path: $(Build.ArtifactStagingDirectory).

CI Build Error with Visual Studio Test step after .Net 4.6 upgrade - Executor process exited; There was no endpoint listening at net.pipe

I just upgraded all of the projects in my solution to point to .Net 4.6 (There is a web app, some class libraries, a database project, etc.). I have a CI build set up in Visual Studio Team Services (using the new build system, not XAML) which was building successfully prior to the upgrade. This build definition runs Debug, Staging, and Production builds and the build definition is comprised of two steps:
Visual Studio Build
Visual Studio Test
Prior to this framework upgrade, everything was building fine. I upgraded and built everything locally and it all worked great too. I could run the tests and got green across the board. Now, when I checked my code in it kicked off the CI build, and I got the following error/s on the "Visual Studio Test" step (taken from the logs):
2015-09-18T19:08:02.1212067Z Microsoft (R) Test Execution Command Line Tool Version 14.0.23107.0
2015-09-18T19:08:02.1489666Z Copyright (c) Microsoft Corporation. All rights reserved.
2015-09-18T19:08:02.8906952Z Starting test execution, please wait...
2015-09-18T19:08:03.3713251Z Warning: Using Isolation mode to run tests as required by effective Platform:X86 and .Net Framework:Framework35 settings for test run. Use the /inIsolation parameter to suppress this warning.
2015-09-18T19:08:07.4457804Z ##[error]Error: Executor process exited.
2015-09-18T19:08:07.4457804Z ##[error]
2015-09-18T19:08:07.4557251Z ##[error]Error: There was no endpoint listening at net.pipe:[...redacted...] that could accept the message. This is often caused by an incorrect address or SOAP action. See InnerException, if present, for more details.
2015-09-18T19:08:07.4557251Z ##[error]
2015-09-18T19:08:07.7730938Z ##[error]VSTest Test Run failed with exit code: 1
2015-09-18T19:08:07.8043435Z ##[warning]No results found to publish.
The Visual Studio Build passes for all three configurations, and the Test step only fails for Debug because it cannot find any tests for the other two configurations. Additionally, my builds are running off of an Azure VM that I stood up to act as a build server, and when I run the CI build using the Hosted build controller the Test step passes, because it cannot find any tests to execute, but the warning about using 'Isolation mode to run tests...' is still printed out in the log.
Is this a known issue? Has anyone else encountered this after a 4.6 upgrade or in another context in VSTS?
Edit: the .Net Framework 4.6 SDK and targeting pack/s ARE installed on the build machine:
The first warning suggests that the tests are running on .NET 3.5:Warning: ... effective Platform:X86 and .Net Framework:Framework35 ...
So I explicitly set the vstest.console framework version to 4.5. (At this time 4.6 is not an available option). That resolved these symptoms for me.
To do so edit the Visual Studio Test build step. On the Build tab of the step settings, expand the Advanced section, and set Other console options to /Framework:Framework45.
I found a workaround for the time being that works for now. I modified the settings for the Visual Studio Test build step as follows:
On the Build tab of the step settings, expand the "Advanced" section, and change the VSTest version to "Visual Studio 2013".
That's all it took for me. I tried this because my build was working when I switched to the Hosted build controller, and this was one of the differences between the two in the logs. This is the only thing that I changed, and it worked. I have no idea WHY the Visual Studio 2015 VSTest version doesn't work, but will look into it more and add to this if I find anything...
I experienced this error (specifically the VSTest exit code) after upgrading a test project to 4.6.1. The issue was that the packages.config didn't update the test framework runner pacakge correctly leaving it at .Net 3.5. Updating the target framework resolved the problem.
After installing .Net Framework 3.5 feature everything was OK! See "cottsay" comment at https://github.com/Microsoft/vsts-tasks/issues/572