Skip to content

Commit 3e2dff4

Browse files
authored
fix(grok): Grok updates actually install on npm 12 (#24246)
1 parent f204389 commit 3e2dff4

2 files changed

Lines changed: 4 additions & 1 deletion

File tree

‎packages/provider-grok/src/server/driver.test.ts‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,8 @@ it.layer(layerTest)("GrokDriver", (it) => {
117117
executable: binaryPath,
118118
args: ["update"],
119119
lockKey: "grok",
120+
// npm 12 otherwise skips the postinstall that installs the new binary.
121+
env: expect.objectContaining({ npm_config_allow_scripts: "@xai-official/grok" }),
120122
}),
121123
},
122124
] as const;

‎packages/provider-grok/src/server/driver.ts‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ const DRIVER_KIND = ProviderDriverKind.make("grok");
5050
// npm latest matches the stable channel installed by grok update.
5151
const GROK_NPM_PACKAGE = "@xai-official/grok";
5252
// `grok update` installs under `GROK_HOME`; use the resolved executable and instance environment.
53+
// npm 12 blocks the postinstall that moves the new binary in, yet exits 0, so allow it by env.
5354
// Homebrew casks need brew upgrades; `grok update` would install a second copy.
5455
// Keep casks manual when their brew cannot vouch for them.
5556
const UPDATE: ProviderMaintenanceCapabilitiesResolver = {
@@ -83,7 +84,7 @@ const UPDATE: ProviderMaintenanceCapabilitiesResolver = {
8384
updateArgs: ["update"],
8485
updateLockKey: "grok",
8586
platform: context.platform,
86-
env: context.env,
87+
env: { ...context.env, npm_config_allow_scripts: GROK_NPM_PACKAGE },
8788
});
8889
}),
8990
};

0 commit comments

Comments
 (0)