Repository navigation
Add npm allowScripts for esbuild to all examples and create-astro - #17756
Merged
Merged
Conversation
…tibility npm v11+ warns about packages with unapproved install scripts, and npm v12 will make this a hard failure. Astro depends on esbuild which has a postinstall script that downloads platform-specific binaries. Add `allowScripts` for esbuild to all example package.json files and add `ensureNpmScriptsAllowed()` to create-astro to pre-approve esbuild in package.json before running `npm install`. Fixes #17745
🦋 Changeset detectedLatest commit: 1bd79b9 The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
1 task
matthewp
approved these changes
Aug 20, 2026
# Conflicts: # examples/basics/package.json # examples/framework-alpine/package.json # examples/hackernews/package.json # examples/minimal/package.json # examples/portfolio/package.json # examples/with-markdoc/package.json
Merged
1 task
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
Adds
"allowScripts": { "esbuild": true }to all 24 examplepackage.jsonfiles and introducesensureNpmScriptsAllowed()inpackages/create-astro/src/actions/dependencies.tsto handle third-party templates as well.Why
npm v11 introduced
allowScripts— a security feature requiring explicit approval of packages with install scripts.esbuild(a direct dependency ofastro) runs apostinstallscript to download platform-specific binaries. Without this approval, npm v11 emits a warning on everynpm install, and npm v12 (expected July 2026) will make it a hard failure.This is the npm counterpart to the pnpm v11
strictDepBuildsfix from PR #17205, which addedensurePnpmBuildsAllowed(). The newensureNpmScriptsAllowed()follows the same pattern.Confirmation
@matthewp confirmed this fix resolves the issue.
Closes #17745