Class NodeInstaller

java.lang.Object
com.vaadin.flow.server.frontend.installer.NodeInstaller

public class NodeInstaller extends Object
Node installation class.

Derived from eirslett/frontend-maven-plugin

For internal use only. May be renamed or removed in a future release.

  • Field Details

  • Constructor Details

    • NodeInstaller

      public NodeInstaller(File installDirectory, List<ProxyConfig.Proxy> proxies)
      Create NodeInstaller with default extractor and downloader and guess platform.
      Parameters:
      installDirectory - installation directory
      proxies - list of proxies
    • NodeInstaller

      public NodeInstaller(File installDirectory, Platform platform, List<ProxyConfig.Proxy> proxies)
      Create NoodeInstaller with default extractor and downloader.
      Parameters:
      installDirectory - installation directory
      platform - platform information
      proxies - list of proxies
    • NodeInstaller

      public NodeInstaller(File installDirectory, Platform platform, ArchiveExtractor archiveExtractor, FileDownloader fileDownloader)
      Initialize a new NodeInstaller.
      Parameters:
      installDirectory - installation directory
      platform - platform information
      archiveExtractor - archive extractor
      fileDownloader - file downloader
  • Method Details

    • setNodeVersion

      public NodeInstaller setNodeVersion(String nodeVersion)
      Set the node version to install. (given as "v16.0.0")
      Parameters:
      nodeVersion - version string
      Returns:
      this
    • setNodeDownloadRoot

      public NodeInstaller setNodeDownloadRoot(URI nodeDownloadRoot)
      Set a custom download root.

      This should be a url or directory under which we can find a directory nodeVersion and there should then exist the archived node packages. For instance for v16.0.0 we should have under nodeDownloadRoot: ./v16.0.0/node-v16.0.0-linux-x64.tar.xz ./v16.0.0/node-v16.0.0-darwin-x64.tar.gz ./v16.0.0/node-v16.0.0-win-x64.zip ./v16.0.0/node-v16.0.0-win-x86.zip

      Parameters:
      nodeDownloadRoot - custom download root
      Returns:
      this
    • setUserName

      public NodeInstaller setUserName(String userName)
      Set user name to use.
      Parameters:
      userName - user name
      Returns:
      this
    • setPassword

      public NodeInstaller setPassword(String password)
      Set password to use.
      Parameters:
      password - password
      Returns:
      this
    • install

      public void install() throws InstallationException
      Install node and npm. This method unconditionally downloads and installs the specified node version without checking if it already exists. Use NodeResolver to check for existing installations before calling this.
      Throws:
      InstallationException - exception thrown when installation fails
    • getInstallDirectory

      public String getInstallDirectory()
    • getDownloadRoot

      public static String getDownloadRoot(Platform platform)
      Get the download root for the given platform.
      Parameters:
      platform - platform to get download root for