v21.2.2 seems to be unable to handle npm workspaces
- 主要语言
- TypeScript
- 星标
- 27k
- 派生
- 11.8k
- 平均合并
- 14 小时 23 分钟
- 30 天内合并 PR
- 162
描述
### Command
update
### Is this a regression?
- [x] Yes, this behavior used to work in the previous version
### The previous version in which this bug was not present was
v20
### Description
While using npm workspaces, `ng update @angular/core@21` (or any other angular package) with installed version `@angular/cli@21` fails with the following error:
```
Using package manager: npm
Collecting installed dependencies...
Found 1 dependencies.
Package '@angular/core' is not a dependency.
```
This does not happen in the same repo with v20 installed (and trying to update to v20). It also does not happen in a repo without npm workspaces.
### Minimal Reproduction
See https://github.com/jsangmeister/angular-cli-repro
I created the repo as follows:
```
npm init
mkdir apps
cd apps
ng new test-app
```
and then moving some files to the top level, e.g., the git folder.
When running `cd apps/test-app && ng update @angular/core@21`, the error appears.
### Exception or Error
```text
Package '@angular/core' is not a dependency.
```
### Your Environment
```text
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI : 21.2.2
Angular : 21.2.4
Node.js : 24.10.0
Package Manager : npm 11.9.0
Operating System : linux x64
┌───────────────────────────┬───────────────────┬───────────────────┐
│ Package │ Installed Version │ Requested Version │
├───────────────────────────┼───────────────────┼───────────────────┤
│ @angular/build │ 21.2.2 │ ^21.2.2 │
│ @angular/cli │ 21.2.2 │ ^21.2.2 │
│ @angular/common │ 21.2.4 │ ^21.2.0 │
│ @angular/compiler │ 21.2.4 │ ^21.2.0 │
│ @angular/compiler-cli │ 21.2.4 │ ^21.2.0 │
│ @angular/core │ 21.2.4 │ ^21.2.0 │
│ @angular/forms │ 21.2.4 │ ^21.2.0 │
│ @angular/platform-browser │ 21.2.4 │ ^21.2.0 │
│ @angular/router │ 21.2.4 │ ^21.2.0 │
│ rxjs │ 7.8.2 │ ~7.8.0 │
│ typescript │ 5.9.3 │ ~5.9.2 │
│ vitest │ 4.1.0 │ ^4.0.8 │
└───────────────────────────┴───────────────────┴───────────────────┘
```
### Anything else relevant?
_No response_
贡献指南
调研方向
从链接的最小复现开始,在 npm-workspaces 仓库中使用 Angular CLI 21.2.2 运行 `cd apps/test-app 6ff ng update @angular/core@21`。将结果与在 v20 下进行相同更新或不使用 workspaces 时的结果进行比较;当 Angular 包被识别为依赖项且更新在没有报告的错误的情况下继续进行时,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- angular, node.js, typescript
- 领域
- cli, tooling
- Issue 类型
- 缺陷
- 难度
- 3/5
- 预计耗时
- 1-2 天
- 活跃度
- 停滞
- 描述清晰度
- 基本清楚
- 新手友好度
- 45/100