"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
@devoto13 I can't seem to find @angular/[email protected], it is not available in the npm registry: https://www.npmjs.com/package/@angular/cli
I was able to install @angular-devkit/[email protected] individually, but that still resulted in a 401 Unauthorized, but not sure if this is related.
@abbazabacto It is @schematics/[email protected] package, which contains the fix. It is a dependency of @angular/cli and the last version of which depends on @schematics/[email protected].
@ajpierson It looks like there is no easy way to try it out at the moment and the easiest way, as you suggest, is to wait until @angular/[email protected] is released. Sorry for the confusion.
Thanks, that's how it looked to me too as free I dug in some more glad to hear I'm not crazy.
On Fri, Jun 1, 2018 at 1:54 AM Yaroslav Admin [email protected] wrote:
@abbazabacto https://github.com/abbazabacto It is @schematics/[email protected] package, which contains the fix. It is a dependency of @angular/cli and the last version depends on @schematics/[email protected].
@ajpierson https://github.com/ajpierson It looks like there is no easy way to try it out at the moment and the easiest way, as you suggest, is to wait until @angular/[email protected] is released. Sorry for the confusion.
— You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub https://github.com/angular/angular-cli/issues/10624#issuecomment-393797741, or mute the thread https://github.com/notifications/unsubscribe-auth/AADcRWLfQ5m6zhLFo2ATQmhNa3C9KgCmks5t4PMZgaJpZM4TyC_f .
We're using a private repository and get "error 401 unauthorized" (see #10704 which was closed as duplicate of this issue). The problem still exists with @angular/[email protected].
"@angular/cli@^6.1.0-rc.0": version "6.1.0-rc.0"
resolved "https://registry.yarnpkg.com/@angular/cli/-/cli-6.1.0-rc.0.tgz#7ffb203ab429beca19003369647015aa707921b9"
dependencies:
"@angular-devkit/architect" "0.7.0-rc.0"
"@angular-devkit/core" "0.7.0-rc.0"
"@angular-devkit/schematics" "0.7.0-rc.0"
"@schematics/angular" "0.7.0-rc.0"
"@schematics/update" "0.7.0-rc.0"
opn "^5.3.0"
rxjs "^6.0.0"
semver "^5.1.0"
symbol-observable "^1.2.0"
yargs-parser "^10.0.0"
Issue still exists inside @angular/[email protected]
I have the same issue with a private git+ssh dependency and trying this against the latest version on master:
Angular CLI: local (v6.1.0-beta.0, branch: master)
Node: 9.10.0
OS: darwin x64
Angular: 5.2.11
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router, service-worker
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.7.0-rc.0
@angular-devkit/build-angular 0.7.0-rc.0
@angular-devkit/build-optimizer 0.7.0-rc.0
@angular-devkit/build-webpack 0.7.0-rc.0
@angular-devkit/core 0.7.0-rc.0
@angular-devkit/schematics 0.7.0-rc.0
@angular/cdk 5.2.5
@angular/cli 1.7.0
@ngtools/webpack 1.10.0
@schematics/angular 0.7.0-rc.0
@schematics/package-update 0.7.0-rc.0
@schematics/update 0.7.0-rc.0
rxjs 5.5.11
typescript 2.5.3
webpack 4.9.2
Also having the not found issue using while using a git+https dependency running @angular/cli 6.0.8
Seems like a common bug, any timeline on the resolution of this?
Any chance the cli could just log not found errors as a warning instead of exiting on them?
Hi Guys,
The issue related with npm's get config command itself.
npm get <key> returns all other configs except _auth and _authToken. Even, npm config list doesn't return them as well.
On update script, it tries to run this command, and this command fails, then actual value became null, so your private registry authentication fails.
https://github.com/angular/angular-cli/blob/6449a753641340d8fc19a752e1a1ced75f974efa/packages/schematics/update/update/npm.ts#L47
So quick and dirty solution is set your auth token manually on ./node_modules/@schematics/update/update/npmjs line number somewhere after 103.
auth = { token: "<your_auth_token", alwaysAuth: true }
FYI: My .npmrc file
strict-ssl=false
registry=https://<company_nexus_npm_registry>
_auth="<base64_token>"
always_auth=true
email=<company_email>
I'll try to create PR for this if anyone created anything similar.
Cheers
@tengis that's some great debugging friend! I just tried this out, and it works beautifully ;)
Important notice for people trying out this fix too, you need to have at least version 6.1.0-rc0 of the @angular/cli package, before editing the npm.js file as suggested.
What PR do you suggest to create, one that fixes the issue in npm itself, or one that 'patches' it in CLI by fetching it somehow from .npmrc and adding it in manually?
Thinking about it, you probably won't be able to change this in npm itself as _auth and _authToken are secrets, and it is desired behaviour to never hand them out using npm get {KEY}, judging from following terminal output:
npm get _authToken
npm ERR! ---sekretz---
@Timebutt Or perhaps add --auth flag on ng update command?!
I really wonder why not using plain npm and make use of the build in authentication. Adding an --auth flag so I have to add authentication again for angular. Very bad idea. Parse .npmrc or just use npm.
We have the same issue now. Does anyone have a solution for this problem?
still seeing this behavior in @angular/[email protected]
even in official 6.1 it's still an issue
Well I don't think that this will be solved any time soon, just guessing by how it is labled.
The good news: I found a bug report that precisely describes the issue we're experiencing The bad news: It's been open since May
😭
Our workaround was to remove our private package, then run...
ng update --registry=https://registry.npmjs.org/ @angular/cli
and then re-install the private package.
The worst? Or simply the worst? The worst.
my hack/solution:
go to node_modules\@schematics\update\update\npm.js and change line 35-ish (first line of the method)
function getNpmClientSslOptions(strictSsl, cafile) {
const sslOptions = { strict: false }; // <---- RIGHT HERE.. normally, it's "{}"
if (strictSsl === 'false') {
sslOptions.strict = false;
}
else if (strictSsl === 'true') {
sslOptions.strict = true;
}
if (cafile) {
sslOptions.ca = fs_1.readFileSync(cafile);
}
return sslOptions;
}
Not sure why it's not getting the setting from the .npmrc file, but this let me get past the issue