Skip to content

Commit 8a7ad69

Browse files
committed
fix: remove --prefer-offline when running npm install
We were using `--prefer-offline` when running `npm install` during `wrangler init`. The behaviour is odd, it doesn't seem to fetch from the remote when the cache isn't hit, which is not what I'm expecting. So we remove `--prefer-offline`.
1 parent 487afde commit 8a7ad69

File tree

2 files changed

+11
-19
lines changed

2 files changed

+11
-19
lines changed

.changeset/shaggy-suns-warn.md

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
"wrangler": patch
3+
---
4+
5+
fix: remove `--prefer-offline` when running `npm install`
6+
7+
We were using `--prefer-offline` when running `npm install` during `wrangler init`. The behaviour is odd, it doesn't seem to fetch from the remote when the cache isn't hit, which is not what I'm expecting. So we remove `--prefer-offline`.

packages/wrangler/src/index.tsx

+4-19
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ export async function main(argv: string[]): Promise<void> {
238238
" "
239239
) + "\n"
240240
);
241-
await execa("npm", ["install", "--prefer-offline"], {
241+
await execa("npm", ["install"], {
242242
stdio: "inherit",
243243
});
244244
console.log(`✨ Created package.json`);
@@ -264,12 +264,7 @@ export async function main(argv: string[]): Promise<void> {
264264
if (shouldInstall) {
265265
await execa(
266266
"npm",
267-
[
268-
"install",
269-
`wrangler@${wranglerVersion}`,
270-
"--save-dev",
271-
"--prefer-offline",
272-
],
267+
["install", `wrangler@${wranglerVersion}`, "--save-dev"],
273268
{
274269
stdio: "inherit",
275270
}
@@ -309,12 +304,7 @@ export async function main(argv: string[]): Promise<void> {
309304
);
310305
await execa(
311306
"npm",
312-
[
313-
"install",
314-
"@cloudflare/workers-types",
315-
"--save-dev",
316-
"--prefer-offline",
317-
],
307+
["install", "@cloudflare/workers-types", "--save-dev"],
318308
{ stdio: "inherit" }
319309
);
320310
console.log(
@@ -340,12 +330,7 @@ export async function main(argv: string[]): Promise<void> {
340330
if (shouldInstall) {
341331
await execa(
342332
"npm",
343-
[
344-
"install",
345-
"@cloudflare/workers-types",
346-
"--save-dev",
347-
"--prefer-offline",
348-
],
333+
["install", "@cloudflare/workers-types", "--save-dev"],
349334
{
350335
stdio: "inherit",
351336
}

0 commit comments

Comments
 (0)