@bobfrankston/npmglobalize 1.0.181 → 1.0.182
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib.js +23 -2
- package/package.json +1 -1
package/lib.js
CHANGED
|
@@ -5463,6 +5463,27 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
5463
5463
|
// before any subsequent install -g symlinks to these dep targets.
|
|
5464
5464
|
if (stashedDepModules.length > 0)
|
|
5465
5465
|
restoreNestedDepModules(stashedDepModules, verbose);
|
|
5466
|
+
// Auto-retry on arborist crash if -clean-nested-modules wasn't already
|
|
5467
|
+
// tried. The crash is the canonical sibling-junctions-in-junctions
|
|
5468
|
+
// failure mode; the fix is mechanical (wipe nested node_modules in
|
|
5469
|
+
// file: targets, pack, restore), so there's no reason to make the user
|
|
5470
|
+
// re-run with the flag they'd pick 100% of the time anyway.
|
|
5471
|
+
if (!packResult.success && !options.cleanNestedModules) {
|
|
5472
|
+
const probe = diagnoseNpmPackFailure(cwd, packResult.output, packResult.stderr, pkg);
|
|
5473
|
+
if (probe.summary.includes('arborist')) {
|
|
5474
|
+
console.error(colors.yellow(` Detected arborist crash — auto-retrying with --clean-nested-modules...`));
|
|
5475
|
+
const autoStash = cleanNestedDepModules(pkg, cwd, verbose);
|
|
5476
|
+
if (autoStash.length > 0) {
|
|
5477
|
+
console.log(colors.yellow(` Cleaned node_modules in ${autoStash.length} file: dep target(s): ${autoStash.map(s => s.name).join(', ')}`));
|
|
5478
|
+
}
|
|
5479
|
+
packResult = await runCommandAsync('npm', ['pack'], { cwd, silent: true });
|
|
5480
|
+
if (autoStash.length > 0)
|
|
5481
|
+
restoreNestedDepModules(autoStash, verbose);
|
|
5482
|
+
if (packResult.success) {
|
|
5483
|
+
console.log(colors.green(' ✓ Auto-retry succeeded after cleaning nested node_modules.'));
|
|
5484
|
+
}
|
|
5485
|
+
}
|
|
5486
|
+
}
|
|
5466
5487
|
if (!packResult.success) {
|
|
5467
5488
|
const d = diagnoseNpmPackFailure(cwd, packResult.output, packResult.stderr, pkg);
|
|
5468
5489
|
console.error(colors.red(`ERROR: ${d.summary}`));
|
|
@@ -5472,8 +5493,8 @@ export async function globalize(cwd, options = {}, configOptions = {}) {
|
|
|
5472
5493
|
console.error(colors.yellow(` Caused by referenced module: ${d.referencedModule}`));
|
|
5473
5494
|
if (d.hint)
|
|
5474
5495
|
console.error(colors.yellow(` Hint: ${d.hint}`));
|
|
5475
|
-
if (d.summary.includes('arborist') &&
|
|
5476
|
-
console.error(colors.yellow(`
|
|
5496
|
+
if (d.summary.includes('arborist') && options.cleanNestedModules) {
|
|
5497
|
+
console.error(colors.yellow(` Already used --clean-nested-modules; the crash is from a deeper sibling. Try running in WSL or wiping nested node_modules manually.`));
|
|
5477
5498
|
}
|
|
5478
5499
|
recordBuildIssue(pkg.name || path.basename(cwd), 'error', d.referencedModule ? `${d.summary} (via ${d.referencedModule})` : d.summary);
|
|
5479
5500
|
return false;
|