Repository navigation
fix(cli): avoid creating app router during postinstall - #1351
diegosouzapw merged 1 commit into
Conversation
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
|
Local repro from a clean Linux source checkout:
up to date, audited 1331 packages in 2s 412 packages are looking for funding found 0 vulnerabilities.
I hit this after a clean reclone, so this was reproducible without any old local junk in the worktree. The key point is that the source checkout does not actually contain a published standalone bundle (), so the standalone-specific postinstall sync should be skipped entirely in that environment. |
|
Clean reproduction from a real Linux source checkout:
I reproduced this after a clean reclone, so it was not caused by stale local junk in the worktree. The core issue is that standalone-only postinstall behavior is being applied in a source checkout where no published standalone app bundle exists. |
|
Thanks @yart for this great contribution! 🎉 The development environment postinstall fix has been integrated into the release/v3.6.8 branch and will be part of the next release. We appreciate your effort protecting the source checkouts from fake App Router roots! |
…1351) Integrated into release/v3.6.8
…1351) Integrated into release/v3.6.8
Summary
app/server.jsbundle is absentapp/directory duringnpm installProblem
3.6.6introduced a startup regression in source checkouts:scripts/postinstall.mjscan createapp/node_modules/...at the repository root while trying to sync standalone-only runtime helpers.scripts/run-next.mjstreats any root-levelapp/directory as a fatal App Router conflict because the real application lives undersrc/app/.npm install,npm startmay abort before the server boots, even though the checkout itself is otherwise healthy.In practice this means a source checkout can fail to start only because
postinstallmaterialized a standalone runtime directory that does not belong in development/source mode.Why this fix
The standalone helper sync is only valid for the published npm artifact, where
app/server.jsexists.In a source checkout there is no standalone app bundle, so creating
app/is both unnecessary and harmful.This fix adds a small guard that only enables the standalone-specific postinstall behavior when the published standalone bundle is actually present.
That keeps npm package installs working while preventing source checkouts from poisoning themselves with a fake App Router root.
Testing
node --import tsx/esm --test tests/unit/postinstall-support.test.ts tests/unit/pack-artifact-policy.test.tsnpm run buildrm -rf app && node scripts/postinstall.mjs && test ! -e appChanged or added test files:
tests/unit/postinstall-support.test.tstests/unit/pack-artifact-policy.test.ts