diff --git a/.changeset/beige-cobras-train.md b/.changeset/beige-cobras-train.md new file mode 100644 index 000000000000..d86ae15fc35a --- /dev/null +++ b/.changeset/beige-cobras-train.md @@ -0,0 +1,5 @@ +--- +"wrangler": patch +--- + +fix: print instructions even if installPackages fails to fetch npm packages diff --git a/packages/wrangler/src/index.tsx b/packages/wrangler/src/index.tsx index f7b639eb97e4..0481777c2082 100644 --- a/packages/wrangler/src/index.tsx +++ b/packages/wrangler/src/index.tsx @@ -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));