# Dependencies

Runtime features an integrated package manager that handles the retrieval, installation, and deployment of third-party packages to support your Functions. This enables developers to access an incredible collection of packages provided by the Node.js community via [npm](https://npmjs.com).

## Default Dependencies

The default version of the Twilio SDK and Runtime handler are a part of all [Builds](/docs/serverless/api/resource/build).

You will always see `twilio` and `@twilio/runtime-handler` in the Dependencies pane of the Twilio Console UI, `package.json` if using the Serverless Toolkit, and in the [Build](/docs/serverless/api/resource/build) response returned by the Serverless API.

> \[!NOTE]
>
> `@twilio/runtime-handler` is not utilized by Functions (Classic), and is not a default dependency in that context.

## Managing Dependencies

> \[!WARNING]
>
> Only public packages, like those hosted by npm, can be managed by the methods below. If you require a private package, you should add it as a [private Asset](/docs/serverless/functions-assets/visibility#private) and [access it](/docs/serverless/functions-assets/client#load-a-module-from-an-asset) from your Function's code instead.

## Twilio Console

Developers can add, remove and update Dependencies through the [Console](https://www.twilio.com/console/functions/overview).

Click the **Dependencies** option under **Settings** to see your Dependencies in the Functions Editor.

![Node.js runtime and npm module dependencies list with options to edit or delete.](https://docs-resources.prod.twilio.com/ca8ca0af82dd6eb4369aa58402fbbc0e356e010914426ec53809ea035e0011d5.png)

This list includes all the npm modules currently installed for the deployed Function.

## Adding a new Dependency

1. Enter the name and version of the npm module you want to include in the first row of empty fields.
2. Click **Add**. This will prepare your next Deployment to install and bundle the npm module with your Functions.

## Changing the version of a Dependency

1. Find the npm module you want to update in the Dependencies list and click **Edit**. Then, enter the new version you want to use in the **Version** field.
2. Click **Update**. This will update the version of the npm module to the specified version on the next Deployment of your Functions.

## Removing a Dependency

1. Click **Delete** to remove any package you want to remove from Dependencies. On the next Deployment of your Functions, the package will no longer be included.

## Serverless Toolkit

If you have created your project using the [Serverless Toolkit](/docs/labs/serverless-toolkit), you will manage your project dependencies using your preferred Node.js package manager and the `package.json` file instead of the Twilio Console.

On project creation, `package.json` should include some minimum defaults, such as the following:

```json
// package.json
{
  // Other values omitted...
  "dependencies": {
    "twilio": "^3.56",
    "@twilio/runtime-handler": "1.2.1"
  },
  "devDependencies": {
    "twilio-run": "^3.4.0"
  }
}
```

## Adding a new Dependency \[#adding-a-new-dependency-2]

1. Use your package manager of choice to install any new dependencies or development dependencies. Using `npm`, an example command would be:

   ```bash
   npm install axios
   ```
2. Deploy your project to ensure that the dependency is available for the deployed Function. For example:

   ```bash
   twilio serverless:deploy
   ```

## Changing the version of a Dependency \[#changing-the-version-of-a-dependency-2]

1. Update the version of the intended dependency

   * Use your package manager of choice to update your intended dependency. For example:

     ```bash
     npm update axios
     ```
   * Manually change the dependency's [version range](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#dependencies) in `package.json`, then run the equivalent of `npm install` to install the newly specified version.
2. Deploy your project to ensure that the dependency is available for the deployed Function. For example:

   ```bash
   twilio serverless:deploy
   ```

## Removing a Dependency \[#removing-a-dependency-2]

1. Use your package manager of choice to remove the desired dependency. For example:

   ```bash
   npm uninstall axios
   ```
2. Deploy your project to ensure that the dependency is removed from all subsequent deployments. For example:

   ```bash
   twilio serverless:deploy
   ```

For additional details, check out the [Project Dependencies](/docs/labs/serverless-toolkit/general-usage#project-dependencies) section of the Serverless Toolkit docs.

## Functions (Classic)

Functions(Classic) is a prior version of Twilio Functions. This is completely independent of the current Functions and Assets API and works in conjunction with Assets(Classic).

Developers can add, remove and update Dependencies through the [Console](/console/runtime/functions/configure). Dependencies can be found in [Functions Settings](/console/runtime/functions/configure) under the **Dependencies** header. This list includes all the npm modules currently installed in the Functions Environment.

## Adding a new Dependency \[#adding-a-new-dependency-3]

1. Click the **+** button at the top of the Packages list. This will add a new row to the Packages table.
2. Enter the name and version of the npm module you want to include in the new row.
3. Click **Save**. This will install and deploy the npm module to the Functions Environment.

## Changing the version of a Dependency \[#changing-the-version-of-a-dependency-3]

1. Find the npm module you want to update in the Packages list. Then enter the new version you want to use in the **Version** field.
2. Click **Save**. This will update the version of the npm module and deploy the Functions Environment with the specified version.

## Removing a Dependency \[#removing-a-dependency-3]

1. Click the **x** on the npm module that you want to remove from your Packages list.
2. Click **Save**. The npm module will be uninstalled, and the Functions Environment will be deployed to complete the removal.

## Staying up to date

Keeping Twilio SDKs up to date enables you to take advantage of the latest Twilio product functionality.

You can [determine the latest](https://github.com/twilio/twilio-node/blob/main/CHANGES.md) version of the Twilio Node SDK, or [set the latest Dependencies](https://www.twilio.com/en-us/changelog/simple-way-add-latest-dependencies-your-twilio-functions) for your Twilio functions by setting them to `*` or `latest` in the Twilio Console UI.

If using the Serverless Toolkit and `package.json`, you could alternatively use a dependency [version range](https://docs.npmjs.com/cli/v7/configuring-npm/package-json#dependencies) such as `"latest"`.

> \[!WARNING]
>
> The version of `@twilio/runtime-handler` must be defined as an explicit value, such as `1.2.1`. Using version ranges, such as `*` and `latest`, will result in a Build failure.

## Limitations

* **Native packages are not supported** — Runtime does not provide a C/C++ compiler, which is required to compile native add-on modules. This means modules that depend on [`node-gyp`](https://github.com/nodejs/node-gyp) can not be used in your Functions.
* **npm modules limit** — Services are limited in the number of npm modules that may be installed. This is dependent on which version of Runtime you are using:

  * Current version: 100 modules.
  * Functions (Classic): 20 modules.
  * To raise these limits for one of your Services, please contact Twilio Support.
