FrontendTools { protected String installNode(String nodeVersion, URI downloadRoot) { NodeInstaller nodeInstaller = new NodeInstaller( new File(getAlternativeDir()), getProxies()) .setNodeVersion(nodeVersion); if (downloadRoot != null) { nodeInstaller.setNodeDownloadRoot(downloadRoot); } try { nodeInstaller.install(); } catch (InstallationException e) { throw new IllegalStateException("Failed to install Node", e); } return new File(nodeInstaller.getInstallDirectory(), getNodeCommands().getFirst()).toString(); } FrontendTools(String baseDir,
            Supplier<String> alternativeDirGetter);  FrontendTools(String baseDir,
                         Supplier<String> alternativeDirGetter,
                         String nodeVersion,
                         URI nodeDownloadRoot);   FrontendTools(String baseDir, Supplier<String> alternativeDirGetter,
            String nodeVersion, URI nodeDownloadRoot,
            boolean ignoreVersionChecks); String getNodeExecutable(); String forceAlternativeNodeExecutable(); List<String> getNpmExecutable(); List<String> getPnpmExecutable(); void ensurePnpm(); void validateNodeAndNpmVersion(); static final String DEFAULT_NODE_VERSION; static final String DEFAULT_PNPM_VERSION; static final String INSTALL_NODE_LOCALLY; static final int SUPPORTED_PNPM_MAJOR_VERSION; static final int SUPPORTED_PNPM_MINOR_VERSION; }
@Test public void installNodeFromFileSystem_NodeIsInstalledToTargetDirectory() throws IOException { prepareNodeDownloadableZipAt(baseDir, "v12.18.3"); String nodeExecutable = tools.installNode("v12.18.3", new File(baseDir).toPath().toUri()); Assert.assertNotNull(nodeExecutable); Assert.assertTrue("npm should have been copied to node_modules", new File(vaadinHomeDir, "node/node_modules/npm/bin/npm") .exists()); }