Repository navigation
fix: add lazy first-use install for npm RFC #868 compatibility - #5291
Merged
Lilian Kasem (liliankasem) merged 1 commit intoJun 2, 2026
Merged
Conversation
When npm RFC #868 ships, postinstall scripts will be blocked by default. This change adds a lazy install check in main.js so that if the func binary is not present (because postinstall was blocked), it is downloaded transparently on the first invocation of the func command. The postinstall script is retained for backward compatibility with older npm versions that still run it automatically. README is updated to document the new behavior and the allowScripts opt-in for users who prefer install-time download. Fixes #5258 Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Naren Soni (soninaren)
approved these changes
Jun 2, 2026
Lilian Kasem (liliankasem)
deleted the
liliankasem/fix-npm-install-script-blocking
branch
June 2, 2026 23:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #5258.
npm RFC #868 will block
postinstallscripts by default in a future npm release (already the behavior in pnpm, Yarn Berry, Bun, and Deno). This would cause silent install failures wherefuncis unusable because the binary was never downloaded.Changes
eng/tools/publish-tools/npm/lib/main.jsAdded an
installIfNeeded()function that runs before spawningfunc. It checks whether the platform binary (bin/funcorbin/func.exe) exists, and if not, runsinstall.jssynchronously viaspawnSyncso the binary is downloaded on first use.README.mdAdded a note in the npm install section explaining:
postinstallis blockedallowScriptsfor newer npmBehavior
npm install✅npm install✅funcrun ✅allowScriptsnpm install✅