Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
1 task done
andreialecu opened this issue Oct 24, 2020 · 4 comments · Fixed by #19217
Closed
1 task done

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

andreialecu opened this issue Oct 24, 2020 · 4 comments · Fixed by #19217
Labels
freq1: low Only reported by a handful of users who observe it rarely ng update DX severity3: broken type: bug/fix
Milestone

Comments

@andreialecu
Copy link
Contributor

andreialecu commented Oct 24, 2020

🐞 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
@andreialecu
Copy link
Contributor Author

Additionally, and related, on yarn 2 these flags are not supported:

return {
silent: '--silent',
saveDev: '--dev',
install: 'add',
prefix: '--modules-folder',
noLockfile: '--no-lockfile',
};

Resulting in this error when trying to install the CLI to a temp path:
image

I'm not sure if a direct workaround is possible, but a manual one is to run yarn add @angular/cli@latest in the project itself.

@alan-agius4
Copy link
Collaborator

Another workaround would be to install the latest version globally. Although this will only work when using Angular CLI version 11 which is still in RC.

I think for the second issue, it’s best to report it as a separate one, as this will require a separate investigation and resolution from the original issue.

@ngbot ngbot bot modified the milestone: Backlog Oct 24, 2020
@alan-agius4 alan-agius4 added feature Issue that requests a new feature freq1: low Only reported by a handful of users who observe it rarely severity3: broken and removed freq1: low Only reported by a handful of users who observe it rarely severity3: broken type: bug/fix feature Issue that requests a new feature labels Oct 24, 2020
@ngbot ngbot bot modified the milestones: Backlog, needsTriage Oct 24, 2020
@ngbot ngbot bot modified the milestones: needsTriage, Backlog Oct 24, 2020
@andreialecu
Copy link
Contributor Author

Opened the second issue separately, here: #19209

@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Nov 27, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
freq1: low Only reported by a handful of users who observe it rarely ng update DX severity3: broken type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants