`ng update` reinstalls with lifecycle scripts skipped and no notice (since 22.3.0-next.5)
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 3/5
- 見積もり時間
- 1〜2日
- 初心者へのやさしさ
- 72/100
- issue の種類
- バグ
- 明瞭さ
- 明確に書かれている
- 活発さ
- 活発
- 技術スタック
- angular, node.js, typescript
調査の方向性
Start with packages/angular/cli/src/commands/update/cli.ts:568-602 and packages/angular/cli/src/package-managers/package-manager.ts:397, then trace how the final project install options reach each package manager. Reproduce with the issue's steps and check whether lifecycle scripts run after ng update; done means scripts run as expected or the command clearly reports that they were skipped and explains how to run them.
索引モデルが issue の本文から書いたものです。
説明
Command
update
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
22.2.6 (every stable release; also 22.3.0-next.4)
Description
Since 22.3.0-next.5, the final "Installing packages" step of ng update passes the package
manager's ignore-scripts flag (npm install --ignore-scripts; --mode=skip-build for modern yarn).
For npm, the update first deletes node_modules ("Cleaning node modules directory"), so after the
reinstall every dependency's preinstall/install/postinstall script — including the
project's own root postinstall — has been skipped. Nothing re-runs them, nothing is printed, and
there is no flag to opt out. For pnpm/yarn/bun there is no wipe, but scripts of the packages changed
by the update are skipped the same way.
Projects that rely on lifecycle scripts break in ways that are hard to connect back to the update:
patch-packagevia rootpostinstall: patches are silently not applied, and the migrations that
run right after the install operate on the unpatched tree;puppeteer,cypress, and similar packages whose postinstall downloads a platform binary.
This comes from a69fe511c ("default ignoreScripts to true when install options are provided"). In
all released versions the final install runs scripts normally: v21.0 still used the legacy
installAll() (no flag), and from 21.1 through 22.2 the = { ignoreScripts: true } parameter
default on install() was replaced entirely by the options object the update command passes
({ ignorePeerDependencies }), so the flag was never added. a69fe511c makes the default apply
per property, which looks right for the temporary tooling installs — but it also silently turns on
script skipping for the final, persistent install of the user's project.
If skipping scripts here is intended, could the command print a notice (e.g. "Lifecycle scripts were
skipped during installation; run your package manager's install/rebuild command to execute them")
and/or offer an opt-out? Otherwise, the final install could pass ignoreScripts: false to restore
the stable-release behavior.
Minimal Reproduction
npx @angular/[email protected] new repro --defaults && cd repro- Add a visible root lifecycle script to
package.json:
"postinstall": "node -e \"require('node:fs').writeFileSync('postinstall-ran.txt','yes')\"" npm install→postinstall-ran.txtis created. Delete it:rm postinstall-ran.txtnpm install --save-dev --save-exact @angular/[email protected]npx ng update @angular/core --next- After "Cleaning node modules directory" and "Installing packages" finish,
postinstall-ran.txt
does not exist — no install script ran, with no notice. Repeating steps 4–5 with
@angular/[email protected]in step 4 recreates the file.
Exception or Error
(none — the scripts are skipped without any notice, which is the issue)
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 22.3.0-next.5
Node.js : 24.15.0
Package Manager : yarn 1.22.22
Operating System : darwin arm64
Anything else relevant?
Code on main:
packages/angular/cli/src/commands/update/cli.ts:568-602— the npm-only "Cleaning node modules
directory" task followed bypackageManager.install({ ignorePeerDependencies }), with no
ignoreScriptsoverride;packages/angular/cli/src/package-managers/package-manager.ts:397—
const { force, ignoreScripts = true, ignorePeerDependencies } = options;ininstall().
Defaulting to ignore-scripts for the temporary package acquisitions (ng add/ng update tooling
installs) is good hardening and not what this issue is about — only the final project install.
Reproduces with every package manager; npm is affected most because of the preceding node_modules
wipe. Not OS- or browser-specific.
- 主要言語
- TypeScript
- スター
- 27k
- フォーク
- 11.8k
- 平均マージ
- 1日 3時間
- マージ済み PR(30日)
- 271
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
angular/angular-cli のほかの issue
-
Font inlining cache is not created or reused対応中かも @nagahara-naoki が今日担当しました。 オープンarea: @angular/build
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
angular/angular-cli#34719 ·
メンテナーはふだん 1 日以内に返信
-
area: @angular/cli
難易度 3/5 半日 初心者へのやさしさ 42/100
angular/angular-cli#34716 ·
メンテナーはふだん 1 日以内に返信
-
`ng generate application` produces a missing stylesheet when a workspace component type is configured対応中かも @nagahara-naoki が 2 日前に担当しました。 オープンarea: @schematics/angular
難易度 2/5 1〜3時間 初心者へのやさしさ 25/100
angular/angular-cli#34684 ·
メンテナーはふだん 1 日以内に返信
-
area: @angular/build
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
angular/angular-cli#34674 · コメント 2 件 ·
メンテナーはふだん 1 日以内に返信
-
Tailwind CSS v4 classes in new or moved files are not picked up by ng serve until another rebuild再び着手できるかも このイシューのプルリクエストはマージされずにクローズされました。 オープンarea: @angular/build
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
angular/angular-cli#34446 ·
メンテナーはふだん 1 日以内に返信
angular/angular-cli の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 62/100
OHDSI/Data2Evidence#3693 ·
メンテナーはふだん 3 日以内に返信
-
severity:low triage:confirmed
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
Cotal-AI/Cotal#6803 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug package:workers-shared
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
cloudflare/workers-sdk#16924 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
-
bug frontend priority: low
難易度 2/5 1〜3時間 初心者へのやさしさ 82/100
nooriegarg/ContribIQ#74 ·
メンテナーはふだん 1 日以内に返信
-
parse: child keys like `007`, `1e3`, `0x1f`, `-1` make the parent an empty array and hide the valueオープン
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100