Open grosch-intl opened 2 years ago
It looks like Yarn 2+ is a can of breaking changes and behaviours. Going through the docs it appears that they removed support for .yarnrc
and instead this was replaced with .yarnrc.yml
and most all of the options have been renamed. In addition to that, unlike Yarn 1 options in .npmrc
are ignored.
More context: https://yarnpkg.com/getting-started/migration#dont-use-npmrc-files https://yarnpkg.com/configuration/yarnrc
Recently @clydin and myself did have a chat that we should probably start using the package manager CLI directly to retrieve the package information example npm info --json @angular/cli
, yarn info @angular/cli --json
.
We just had a similar issue with ng update, it was not able to resolve our companies package repositories configured in our .yarnrc.yml
@dedalusMohantyMa we have the same issue you're describing. Did you find any workarounds?
As a workaround you can try to use the β-registry
option.
I could ng update
to v15 the following way:
yarn.lock
and move .yarnrc.yml
to somewhere outside the git reporegistry=β¦
and other settings you had/need from .yarnrc.yml)ng update @angular/core@15 @angular/cli@15
.yarnrc.yml
back into the projectyarn install
I could
ng update
to v15 the following way:* Delete `yarn.lock` and move `.yarnrc.yml` to somewhere outside the git repo * Add .npmrc (add `registry=β¦` and other settings you had/need from .yarnrc.yml) * Commit changes "feat: update to angular 15" (we'll amend this commit later) * run update command `ng update @angular/core@15 @angular/cli@15` * remove package-lock.json * remove .npmrc * move your `.yarnrc.yml` back into the project * `yarn install` * add all changes and amend previous commit * done
I guess then I also have to change my package manager configuration in my angular.json
for this to work
This is blocking my team from being able to update angular. We have a few private npm packages that authenticate using the .yarnrc.yml
file, but it appears ng cli is unable to pick up on these settings.
I tried running this update with the latest ng cli available, and it still fails with this error. I also tried the workaround mentioned above by trying to use an .npmrc file instead, but with no luck.
ng update
Using package manager: yarn
Collecting installed dependencies...
Found 113 dependencies.
β Migration failed: 404 Not Found - GET https://registry.npmjs.org/@fortawesome%2ffontawesome-pro - Not found
See "/private/var/folders/ct/wgx3r7xn3432crb39pmcw35r0000gs/T/ng-WNmI7y/angular-errors.log" for further details.
Here is my .yarnrc.yml
:
enableStrictSsl: false
nmHoistingLimits: workspaces
nodeLinker: node-modules
npmScopes:
fortawesome:
npmAlwaysAuth: true
npmAuthToken: <redacted>
npmRegistryServer: "https://npm.fontawesome.com/"
vicore:
npmAlwaysAuth: true
npmPublishRegistry: "<redacted>"
npmRegistryServer: "<redacted>"
xactremodel:
npmAlwaysAuth: true
npmPublishRegistry: "<redacted>"
npmRegistryServer: "<redacted>"
yarnPath: .yarn/releases/yarn-2.4.3.cjs
@harryt04 it should not say Using package manager: yarn
when running the ng update - you need to switch to npm as your package manager for the workaround to work. Check your Project if there is more relation to yarn and remove it before the ng update (and restore it after) - good luck!
Any update on that?
We've used the workaround suggested above (temporarily switch to NPM) for the initial v15 update, but any further update requires the same workaround over and over.
Upgrading to Angular 16, and facing the same issue again. The workaround from https://github.com/angular/angular-cli/issues/23448#issuecomment-1331964881 (switch to NPM, update, switch back) has helped - but it's super annoying.
π Bug report
Command (mark with an
x
)Is this a regression?
Unknown
Description
A clear and concise description of the problem... ## π¬ Minimal Reproduction ng new repo cd repo yarn set version berry yarn install ng add @infragistics/igniteui-angular ## π₯ Exception or Error So you can see that while it's using yarn, it's somehow avoiding the `~/.yarnrc.yml` file. ## π Your Environment **Anything else relevant?** My ~/.angular-config.json files specifies to use yarn ```json $ cat ~/.angular-config.json { "version": 1, "cli": { "analytics": false, "packageManager": "yarn", "completion": { "prompted": true } } } ``` If I just straight-up run a `yarn install` of that package, it works without issue, showing that my yarn configuration is set up properly as far as a proxy, the registry for that prefix, etc...ng add
fails to look at the custom registry definition. If I run withng add
it fails due to look for the package in registry.npmjs.org. If I instead justyarn install
it looks at the custom registry from the vendor.