# Migrate Tasks to Node24 ## Table of content [Update `typescript`](#update-typescript) [Update `@types/node`](#update-typesnode) [Update `task-lib`, `tool-lib`, and `node-api`](#update-task-lib-tool-lib-and-node-api) [Add `Node24` handler](#add-node24_1-handler) [Specify `minimumAgentVersion`](#specify-minimumagentversion) [Test the changes](#test-the-changes) [Feedback](#feedback) ## Update `typescript` Update `typescript` to the `^5.7.2` version in `devDependencies` in the `package.json` file and fix type errors. ```json "devDependencies": { "typescript": "^5.7.2" } ``` ## Update `@types/node` Update `@types/node` to the `^24.10.0` version in `dependencies` in the `package.json` file. ```json "dependencies": { "@types/node": "^24.10.0" } ``` If the task does not use built-in Node.JS modules (such as `fs` or `path`) directly, remove `@types/node` from the task dependencies. ## Update `task-lib`, `tool-lib`, and `node-api` Update the following packages in `package.json` dependencies, if a task has these packages: - `azure-pipelines-task-lib` to `^5.2.4` - `azure-pipelines-tool-lib` to `^2.0.10` - `azure-devops-node-api` to `^15.1.3` ```json "dependencies": { "azure-pipelines-task-lib": "^5.2.4", "azure-pipelines-tool-lib": "^2.0.10", "azure-devops-node-api": "^15.1.3" } ``` `task-lib` package uses some shared (e.g. global object) resources to operate so it may cause unexpected errors in cases when more than one version of the package is installed for a task. This happens if `task-lib` in subdependencies of the task (e.g. in some common npm packages used by the task) has a different version than in dependencies of the task itself. Same for `tool-lib` and `node-api`. If the task uses `task-lib`, `tool-lib`, `node-api`, and some common npm packages that use these packages as well, make sure they have the same version in common npm packages as in the task itself. As a possible solution you also can remove these package versions via the `make.json` file, for example: ```json { "rm": [ { "items": [ "node_modules/any-common-npm-package/node_modules/azure-pipelines-task-lib", "node_modules/any-common-npm-package/node_modules/azure-pipelines-tool-lib", "node_modules/any-common-npm-package/node_modules/azure-devops-node-api" ], "options": "-Rf" } ] } ``` Here is [the repo with different common npm packages](https://github.com/microsoft/azure-pipelines-tasks-common-packages) that can be used in the task. ## Add `Node24` handler Add a new `Node24` execution handler in the `task.json` file. > **⚠️ Deprecation Notice**: Node 6, Node 10, and Node 16 handlers are deprecated and on the end-of-life (EOL) path. We strongly encourage removing these handlers from your tasks and migrating to Node 20 or Node 24.
| From | To |
|---|---|
| ```json "execution": { "Node20_1": { "target": "main.js", "argumentFormat": "" } } ``` | ```json "execution": { "Node20_1": { "target": "main.js", "argumentFormat": "" }, "Node24": { "target": "main.js", "argumentFormat": "" } } ``` |