Skip to content

ng update fails to install @angular/cli with yarn v4 #33972

Description

@pascal-puetz

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

21

Description

When using ng update to update a package, the Angular CLI itself is updated first. This update fails with the following error message when using yarn v4:

The installed Angular CLI version is outdated.
Installing a temporary Angular CLI versioned latest to perform the update.                                                                                                      
Error: Package installation failed: Process exited with code 1.
Output: Usage Error: The nearest package directory (/Users/redacted/workspaces/my-project/node_modules/angular-cli-tmp-packages-an3wWo) doesn't seem to be part of the project declared in /Users/redacted/workspaces/my-project/
                                                                                                                                                                                
- If /Users/redacted/workspaces/my-project isn't intended to be a project, remove any yarn.lock and/or package.json file there.                                  
- If /Users/redacted/workspaces/my-project is intended to be a project, it might be that you forgot to list node_modules/angular-cli-tmp-packages-an3wWo in its workspace configuration.                                                                                                                                                         
- Finally, if /Users/redacted/workspaces/my-project is fine and you intend node_modules/angular-cli-tmp-packages-an3wWo to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.                                                                                                             
                                                                                                                                                                                
$ yarn add [--json] [-F,--fixed] [-E,--exact] [-T,--tilde] [-C,--caret] [-D,--dev] [-P,--peer] [-O,--optional] [--prefer-dev] [-i,--interactive] [--cached] [--no-time-gate] [--mode #0] ...

The issue seems to be that the temporary version is now installed using yarn v4 in a subfolder of the current workspace. This makes yarn believe it should be part of the project's workspace.

Minimal Reproduction

Create a new angular project using an outdated version
Setup yarn v4 (e.g. using yarn set version stable)
Install dependencies using yarn install
Try to update using ng update @angular/core --allow-dirty (or any other package)

Exception or Error

Error: Package installation failed: Process exited with code 1.
Output: Usage Error: The nearest package directory (/Users/redacted/workspaces/my-project/node_modules/angular-cli-tmp-packages-an3wWo) doesn't seem to be part of the project declared in /Users/redacted/workspaces/my-project/
                                                                                                                                                                                
- If /Users/redacted/workspaces/my-project isn't intended to be a project, remove any yarn.lock and/or package.json file there.                                  
- If /Users/redacted/workspaces/my-project is intended to be a project, it might be that you forgot to list node_modules/angular-cli-tmp-packages-an3wWo in its workspace configuration.                                                                                                                                                         
- Finally, if /Users/redacted/workspaces/my-project is fine and you intend node_modules/angular-cli-tmp-packages-an3wWo to be treated as a completely separate project (not even a workspace), create an empty yarn.lock file in it.

Your Environment

_                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI       : 22.0.8
Angular           : 22.0.8
Node.js           : 24.18.0
Package Manager   : yarn 4.12.0
Operating System  : darwin arm64

┌───────────────────────────────────┬───────────────────┬───────────────────┐
│ Package                           │ Installed Version │ Requested Version │
├───────────────────────────────────┼───────────────────┼───────────────────┤
│ @angular-devkit/build-angular     │ 22.0.8            │ ^22.0.7           │
│ @angular/build                    │ 22.0.8            │ ^22.0.8           │
│ @angular/cdk                      │ 20.2.14           │ ^20.2.14          │
│ @angular/cli                      │ 22.0.8            │ ^22.0.7           │
│ @angular/common                   │ 22.0.8            │ ^22.0.0           │
│ @angular/compiler                 │ 22.0.8            │ ^22.0.0           │
│ @angular/compiler-cli             │ 22.0.8            │ ^22.0.0           │
│ @angular/core                     │ 22.0.8            │ ^22.0.0           │
│ @angular/forms                    │ 22.0.8            │ ^22.0.0           │
│ @angular/platform-browser         │ 22.0.8            │ ^22.0.0           │
│ @angular/platform-browser-dynamic │ 22.0.8            │ ^22.0.0           │
│ @angular/router                   │ 22.0.8            │ ^22.0.0           │
│ rxjs                              │ 7.8.2             │ ~7.8.0            │
│ typescript                        │ 6.0.3             │ ~6.0.2            │
│ vitest                            │ 4.1.10            │ ^4.1.10           │
└───────────────────────────────────┴───────────────────┴───────────────────┘

Anything else relevant?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions