Documentation

Documentation versions (currently viewingVaadin 24)

Configuring Node.js

Installing and using Node.js locally and in CI servers.

Vaadin uses the Node.js runtime in development mode to run the Vite development server, as well as the Node.js package manager (npm) and package runner (npx) to fetch, install, and run front-end packages.

Node.js can be installed in three ways:

  • Automatically into the user’s home directory (~/.vaadin/node).

  • Globally with a downloaded installer or package manager, such as Homebrew.

  • Project-local installation (project_dir/node) using the frontend-maven-plugin.

For the second way, globally, Node.js can be downloaded from https://nodejs.org/en/download/. Installing Node.js automatically installs the command-line tools npm and npx, as well.

If Node.js is found globally, Vaadin validates that it’s a supported version: if it’s too old, it installs a compatible version into ~/.vaadin. You should use the latest Long-Term Support (LTS) version. A project-local installation always takes precedence over a global or ~/.vaadin installation.

You can force Node.js installation in the ~/.vaadin folder via the require.home.node property. This property sets the Maven requireHomeNodeExec parameter value, so you can configure the Maven goal using <requireHomeNodeExec>true</requireHomeNodeExec>. To force node installation into the home directory in development mode, you should use the vaadin.require.home.node system property or the require.home.node web init parameter.

Proxy Settings for Downloading the Front-End Toolchain

If you’re operating behind a proxy server, you should configure your proxy settings so that Vaadin can use them to download the front-end toolchain. Vaadin reads proxy settings from four places.

You can set your proxy data in any of the following:

  1. System properties;

  2. {project directory}/.npmrc file;

  3. {user home directory}/.npmrc file; or

  4. Environment variables.

The settings are read from the list here, in this order. For example, if you set your proxy in system properties, the other sources are ignored.

The keys that you should use to define your proxy settings are as follows:

In System Properties and Environment Variables In .npmrc files Description

HTTP_PROXY

proxy

A proxy to use for outgoing HTTP requests.

HTTPS_PROXY

https-proxy

A proxy to use for outgoing HTTPS requests.

NOPROXY

noproxy

A comma-separated string of domain extensions for which a proxy shouldn’t be used.

The .npmrc file structure is ini — like Java properties files. It includes key-values pairs separated by =.

Here’s an example of the content of such a file with proxy settings:

proxy=http://myusername:s3cr3tpassw0rd@proxyserver1:8085"
https-proxy=http://myusername:s3cr3tpassw0rd@proxyserver1:8086"
noproxy=192.168.1.1,vaadin.com,mycompany.com

To learn more about the .npmrc file, see the official npmrc document.

Building an Application Using Travis CI

If you’re using Travis as a Continuous Integration server, there are two options to install a proper Node.js version:

  1. Specify the version via Travis configuration in .travis.yml; or

  2. Install Node.js automatically through Vaadin.

See Specifying Node.js versions in the Travis documentation for information on how to specify the Node version via the .travis.yml file.

You can force Node.js installation to the ~/.vaadin folder, as described in the section Configuring Node.js.

33A25C64-2E6E-4F6F-9C0E-5EEFD244D4B3