fix: remove --prefer-offline flag to prevent stale cache errors (#1531)

The --prefer-offline flag causes npm to use cached package metadata,
which can be stale and fail to resolve recently published versions.

Also updates deprecated --production flag to --omit=dev.

Fixes #1438
This commit is contained in:
Drickon 2026-02-05 19:06:26 -06:00 committed by GitHub
parent 420e720242
commit 068a9dc45a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 2 additions and 2 deletions

View File

@ -417,7 +417,7 @@ class ModuleManager {
if (needsDependencyInstall || wasNewClone || nodeModulesMissing) { if (needsDependencyInstall || wasNewClone || nodeModulesMissing) {
const installSpinner = ora(`Installing dependencies for ${moduleInfo.name}...`).start(); const installSpinner = ora(`Installing dependencies for ${moduleInfo.name}...`).start();
try { try {
execSync('npm install --production --no-audit --no-fund --prefer-offline --no-progress --legacy-peer-deps', { execSync('npm install --omit=dev --no-audit --no-fund --no-progress --legacy-peer-deps', {
cwd: moduleCacheDir, cwd: moduleCacheDir,
stdio: 'pipe', stdio: 'pipe',
timeout: 120_000, // 2 minute timeout timeout: 120_000, // 2 minute timeout
@ -442,7 +442,7 @@ class ModuleManager {
if (packageJsonNewer) { if (packageJsonNewer) {
const installSpinner = ora(`Installing dependencies for ${moduleInfo.name}...`).start(); const installSpinner = ora(`Installing dependencies for ${moduleInfo.name}...`).start();
try { try {
execSync('npm install --production --no-audit --no-fund --prefer-offline --no-progress --legacy-peer-deps', { execSync('npm install --omit=dev --no-audit --no-fund --no-progress --legacy-peer-deps', {
cwd: moduleCacheDir, cwd: moduleCacheDir,
stdio: 'pipe', stdio: 'pipe',
timeout: 120_000, // 2 minute timeout timeout: 120_000, // 2 minute timeout