Skip to content

[Yarn2] Migrations fail when using custom protocols in package.json #19203

Closed
@andreialecu

Description

@andreialecu

🐞 Bug report

Command (mark with an x)

  • update

Is this a regression?

No

Description

Yarn 2 allows using custom protocols for dependencies. A current list is available here:
https://yarnpkg.com/features/protocols

It seems that when trying to use ng update for migrations, the process fails because it thinks it finds a malformed specifier.

I believe this should not be a hard error, but perhaps just a warning. It is safe to ignore these dependencies.

Note that this error occurs with the currently compatible Yarn2/Angular mode of using the standard node_modules linker. See: #16980

Relevant section of code:

throw new SchematicsException(
`Failed to parse dependency "${name}" with specifier "${specifier}"`
+ ` from package.json. Is the specifier malformed?`);

🔬 Minimal Reproduction

cd /tmp
ng new --skip-install ngupdate-repro
cd ngupdate-repro

yarn set version 2
yarn config set nodeLinker node-modules
yarn install

yarn add @angular/cli@latest
yarn add @angular/material@8.2.3

yarn add src@link:./src


yarn ng update @angular/material --allow-dirty

🔥 Exception or Error

Repository is not clean. Update changes will be mixed with pre-existing changes.
Using package manager: 'yarn'
Collecting installed dependencies...
Found 31 dependencies.
Fetching dependency metadata from registry...
✖ Migration failed: Failed to parse dependency "src" with specifier "link:./src" from package.json. Is the specifier malformed?
  See "/tmp/ng-SLmx6n/angular-errors.log" for further details.

🌍 Your Environment


ngular CLI: 10.2.0
Node: 13.7.0
OS: linux x64

Angular: 10.1.6
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1001.7
@angular-devkit/build-angular   0.1001.7
@angular-devkit/core            10.2.0
@angular-devkit/schematics      10.2.0
@angular/cli                    10.2.0
@angular/material               8.2.3
@schematics/angular             10.2.0
@schematics/update              0.1002.0
rxjs                            6.6.3
typescript                      4.0.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions