"ng update" doesn't support private repos such as FontAwesome 5 Pro
Versions
Angular CLI: 6.0.0
Node: 9.11.1
OS: darwin x64
Angular: 6.0.0
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.6.0
@angular-devkit/build-angular 0.6.0
@angular-devkit/build-optimizer 0.6.0
@angular-devkit/core 0.6.0
@angular-devkit/schematics 0.6.0
@ngtools/webpack 6.0.0
@schematics/angular 0.6.0
@schematics/update 0.6.0
rxjs 6.1.0
typescript 2.7.2
webpack 4.6.0
Repro steps
- Add dependency on a private repo such as FontAwesome 5 Pro
- Run ng update @angular/core
Observed behavior
Not found : @fortawesome/pro-regular-svg-icons
Mention any other details that might be useful (optional)
This works fine using npm directly because the private repo has already been registered with npm
It works now using rc.0 and
ng update @angular/core --registry https://%registry/repository/%group-name%/
Not a solution but a workaround 😃
@kroeder does your .npmrc literally have the %'s or are those only for comment replacement purposes?
Just placeholders because I don't want to share the exact URL :) have no vars
Hmm.
I have globally and locally @angular/cli 7.1.0. Our project uses '@angular/*' "^6.1.0".
Did a clean yarn install - there was no yarn.lock or node_modules prior to the install.
Then I wanted to perform ng update '@angular/cli'.
I got this red line as result:
401 Unauthorized - GET https://npm.fontawesome.com/@fortawesome%2fpro-regular-svg-icons
Same result with ng update '@angular/core'.
As a reminder, our local .npmrc is (we do not use .npmrc in HOME directory):
@XXXXXXXXXX:registry=https://artifactory.YYYYYYYYYY:443/artifactory/api/npm/npm-virtual/
@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=${NPM_TOKEN_FONTAWESOME}
PUPPETEER_SKIP_CHROMIUM_DOWNLOAD=true
depth=0
loglevel=warn
package-lock=false
progress=false
It only works if I replace ${NPM_TOKEN_FONTAWESOME} with the real token string.
I take it @clydin's enhancement to support ENV variables in .npmrc has not landed yet.
@catull The environment variable support will be in 7.1.1.
Excellent, thanks!
+1 same issue with 7.1.0 - @microsoft fix it
The problem for angular-cli 7.1.0 is in angular-cli/packages/schematics/update/update/npm.ts
const resultPromise = pacote.packument(
packageName,
{
'full-metadata': true,
...npmrc,
registry: options && options.registryUrl,
},
);
This line contains error:
registry: options && options.registryUrl
If you pass any cli options, but don't pass registryUrl inside this options - this line will generate "registry: undefined" that always overrides ".npmrc" value.
And pacote when see this - uses default registry.npmjs.org
The fix is simple - check that options.registryUrl has some value, before passing it to pacote. I can try to make a fix, and also some tests for it :)
@denisoby Don't bother.
@hansl committed a fix with https://github.com/angular/angular-cli/commit/6fce79355fb6305f3db2e627fdf345b9ac1f173b @clydin enhanced it with https://github.com/angular/angular-cli/pull/13106/commits/e85da635cd70ddcf1eddee430a7d740eaa3bc53e
Just wait for version @angular/[email protected]
Edit: It has landed now. Enjoy it!
With 7.1.1 I get 404 errors again. Scoped packages seams not to be recognized correctly.
Is there an article describing what to do know? Im using Windows and don't know how to get it working:
- Use .npmrc in local and/or HOME ?
- Do I have to use environment variables for auth-keys?
Deleted my local .nmprc to update version of @angular/cli to 7.1.1. Restored the local .npmrc and trying to start ng update
If I then try to start ng update getting also the 404 with scoped package names:
like: /@angular-devkit%2fbuild-angular
This should have been fixed by https://github.com/angular/angular-cli/pull/13025
@alan-agius4 I am running 7.1.2 and I still have this problem with a private repo.
@Albyzai can you kindly try to use the next version? Note that you should also update @angular/devkit packages
@alan-agius4
This is my output:
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.1.2
Node: 8.12.0
OS: win32 x64
Angular: 7.1.2
... animations, cli, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.7
@angular-devkit/build-angular 0.10.7
@angular-devkit/build-optimizer 0.10.7
@angular-devkit/build-webpack 0.10.7
@angular-devkit/core 7.0.7
@angular-devkit/schematics 7.1.2
@angular/cdk 7.1.1
@ngtools/webpack 7.0.7
@schematics/angular 7.1.2
@schematics/update 0.11.2
rxjs 6.3.3
typescript 3.1.1
webpack 4.19.1
@Albyzai, can you try to use @angular/cli@next and see if the problem persists?
@alan-agius4
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 7.2.0-beta.1
Node: 8.12.0
OS: win32 x64
Angular: 7.1.2
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.10.7
@angular-devkit/build-angular 0.10.7
@angular-devkit/build-optimizer 0.10.7
@angular-devkit/build-webpack 0.10.7
@angular-devkit/core 7.0.7
@angular-devkit/schematics 7.2.0-beta.1
@angular/cdk 7.1.1
@angular/cli 7.2.0-beta.1
@ngtools/webpack 7.0.7
@schematics/angular 7.2.0-beta.1
@schematics/update 0.12.0-beta.1
rxjs 6.3.3
typescript 3.1.1
webpack 4.19.1
Problem still persists.
btw. is this going to be released into ^6.x.x?
There are quite some repos still out there on versions before 6 and the angular-team behind https://update.angular.io doesn't recommend to move across multiple major versions.
Hence it would be great to get it into 6 as well.
It works for me, since 7.1.1.
@Albyzai Care to show us your .npmrc, mask out the spicy bits.
@catull
Will do on Monday, got it on my work PC.