Skip to content

Commit 515a52f

Browse files
authored
fix: print instructions even if installPackages fails (#1110)
1 parent de59ee7 commit 515a52f

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed

.changeset/beige-cobras-train.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
fix: print instructions even if installPackages fails to fetch npm packages

packages/wrangler/src/index.tsx

+11-1
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,17 @@ function createCLIParser(argv: string[]) {
759759
}
760760
}
761761
// install packages as the final step of init
762-
await installPackages(shouldRunPackageManagerInstall, devDepsToInstall);
762+
try {
763+
await installPackages(shouldRunPackageManagerInstall, devDepsToInstall);
764+
} catch (e) {
765+
// fetching packages could fail due to loss of internet, etc
766+
// we should let folks know we failed to fetch, but their
767+
// workers project is still ready to go
768+
logger.error(e instanceof Error ? e.message : e);
769+
instructions.push(
770+
"\n🚨 wrangler was unable to fetch your npm packages, but your project is ready to go"
771+
);
772+
}
763773

764774
// let users know what to do now
765775
instructions.forEach((instruction) => logger.log(instruction));

0 commit comments

Comments
 (0)