Skip to content

Commit 3e3554c

Browse files
fix: Show patience notice right before npm install starts (#13151) (#13154)
Co-authored-by: Tarek Oraby <42799254+tarekoraby@users.noreply.github.com>
1 parent f97b8e9 commit 3e3554c

1 file changed

Lines changed: 12 additions & 10 deletions

File tree

‎flow-server/src/main/java/com/vaadin/flow/server/frontend/TaskRunNpmInstall.java‎

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -177,19 +177,9 @@ public String getPackageManager() {
177177
public void execute() throws ExecutionFailedException {
178178
String toolName = enablePnpm ? "pnpm" : "npm";
179179
if (packageUpdater.modified || shouldRunNpmInstall()) {
180-
// Log a stronger request for patience if package-lock.json is
181-
// missing as "npm install" in this case can take minutes
182-
// https://github.com/vaadin/flow/issues/12825
183-
File packageLockFile = packageUpdater.getPackageLockFile();
184180
packageUpdater.log().info("Running `" + toolName + " install` to "
185181
+ "resolve and optionally download frontend dependencies. "
186182
+ "This may take a moment, please stand by...");
187-
if (!enablePnpm && !packageLockFile.exists()) {
188-
packageUpdater.log().warn("Missing package-lock.json may cause "
189-
+ "npm package installation to take several minutes; "
190-
+ "it is recommended to keep this file persistently "
191-
+ "in your project");
192-
}
193183
runNpmInstall();
194184

195185
updateLocalHash();
@@ -359,6 +349,18 @@ private void runNpmInstall() throws ExecutionFailedException {
359349
logger.info("using '{}' for frontend package installation",
360350
String.join(" ", npmInstallCommand));
361351

352+
// Log a stronger request for patience if package-lock.json is
353+
// missing as "npm install" in this case can take minutes
354+
// https://github.com/vaadin/flow/issues/12825
355+
File packageLockFile = packageUpdater.getPackageLockFile();
356+
if (!enablePnpm && !packageLockFile.exists()) {
357+
packageUpdater.log().warn("package-lock.json is missing from this "
358+
+ "project. This may cause the npm package installation to "
359+
+ "take several minutes. It is recommended to keep the "
360+
+ "package-lock.json file persistently in your project. "
361+
+ "Please stand by...");
362+
}
363+
362364
Process process = null;
363365
try {
364366
process = runNpmCommand(npmInstallCommand,

0 commit comments

Comments
 (0)