TeamCity On-Premises 2021.1 Help

Node.js

The Node.js build runner, provided in terms of TeamCity EAP 2021.1, allows running Node.js tools like npm, yarn, and node.

Refer to Configuring Build Steps for a description of common build steps' settings. Refer to Docker Wrapper to learn how you can run this step inside a Docker container.

Prerequisites

In terms of EAP, Node.js steps can only be run inside a Docker container. node:lts is used by default.

Autodetecting JS Steps

If your repository contains a package.json file, TeamCity will automatically detect used frameworks and propose adding respective build steps.

Currently supported frameworks are ESlint, Jest, Mocha, and Hermione.

If TeamCity detects an .nvmrc file, it will automatically use the node version specified in it.

Accessing Private Registries

To access a private npm registry during a build (for example, to download some package), you need to:

  1. In Project Settings | Connections, configure an NPM Registry connection: specify the registry URL, automation access token, and a scope.

  2. In Build Configuration Settings | Build Features, add an NPM Registry Connection build feature and select the new connection, so it can be used in this configuration.

As a result, a TeamCity agent will authenticate in this registry during the build and sign out after its finish.

Alternatively to this procedure, you can let TeamCity parse a token from the .npmrc file inside your JS project. To achieve this, declare a token variable in this file as specified here and then create an environment variable NPM_TOKEN in TeamCity with the value of the access token and the Password type.

Last modified: 28 April 2021