Skip to content

Commit

Permalink
fix: print instructions even if installPackages fails (#1110)
Browse files Browse the repository at this point in the history
  • Loading branch information
rozenmd authored May 25, 2022
1 parent de59ee7 commit 515a52f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/beige-cobras-train.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"wrangler": patch
---

fix: print instructions even if installPackages fails to fetch npm packages
12 changes: 11 additions & 1 deletion packages/wrangler/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -759,7 +759,17 @@ function createCLIParser(argv: string[]) {
}
}
// install packages as the final step of init
await installPackages(shouldRunPackageManagerInstall, devDepsToInstall);
try {
await installPackages(shouldRunPackageManagerInstall, devDepsToInstall);
} catch (e) {
// fetching packages could fail due to loss of internet, etc
// we should let folks know we failed to fetch, but their
// workers project is still ready to go
logger.error(e instanceof Error ? e.message : e);
instructions.push(
"\n🚨 wrangler was unable to fetch your npm packages, but your project is ready to go"
);
}

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

0 comments on commit 515a52f

Please sign in to comment.