The Vercel platform allows you to install private dependencies in your project by assigning a special Environment Variable at build time.

Private npm Dependencies

To provide your deployments with access to private npm dependencies, add your private npm token as an Environment Variable to your project from the Vercel dashboard. This can be found by selecting the project, and viewing the general tab under the project settings.

Select the desired Environment tab (Production or Preview) and add the key NPM_TOKEN with the your private token for the npm registry as the value.

Other Package Registries

To use private packages from registries other than npm, add the contents of your .npmrc file as an Environment Variable to your project from the Vercel dashboard. This can be found by selecting the project, and viewing the general tab under the project settings.

Select the desired Environment tab (Production or Preview) and add the key NPM_RC with the contents of your .npmrc file as the value. Since this file typically has newlines, it might be easier to use the CLI: vc env add NPM_RC production < ~/.npmrc

Also note that Vercel Runtimes are installed from the canonical npm registry so registry.npmjs.org must be one of the lines in your .npmrc file.

How this Works

At build time, Vercel will dynamically create a .npmrc file and then install your dependencies from package.json.

This allows you access to private packages without having to commit your own .npmrc file to source control.