angular-cli: "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
About this issue
- Original URL
- State: closed
- Created 6 years ago
- Reactions: 114
- Comments: 172 (45 by maintainers)
There is definitely a problem when using a private npm repository. I could only run
ng updatecorrectly once I removed my.npmrcfile, and removed every private package frompackage.json. After runningng update @angular/cli'it finally correctly generated theangular.jsonfile and I readded all the references I removed before.@hansl & @filipesilva This thread still has the “need more info” and “low frequency” labels. Based on the thread’s activity, I assume that both are not valid anymore and possibly give a false impression of the severity of this issue.
Same problem with 6.0.7 just now.
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/cli@6.1.0-rc.0.
The team is aware of the issue and there is a pending PR (https://github.com/angular/angular-cli/pull/12526) which will vastly improve the current situation. Unfortunately, it is currently blocked on an upstream issue (https://github.com/zkat/pacote/issues/163).
While looking at the growing list of bugs relating
.npmrc#10704 #10571 #10660 I think this should be fixed asap+1, can’t we just read the .npmrc on install or have an alternative flag that skips the npm check and simply updates angular?
Why is this need more info and low frequency @hansl? It affects nearly every corporate developer because we all have private npm packages. Not to mention anyone who has spent the time to decouple their application into components.
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
.npmrcor just usenpm.Looks like I found a solution, at least for Nexus repository. I already filed this as a pull request, however it would be really good to have some feedback from you guys. Especially would be cool to have some Artifactory users’ feedback.
How to try it right now: replace the
your_project/node_modules/@schematics/update/update/npm.jswith the following contentAfter that the
ng updateshould start working.Issue still exists inside @angular/cli@6.0.8
I’m also having this same problem with @angular/cli@6.0.3 and VSTS
Confirmation that @angular/cli 6.0.0+ has broken authentication to private npm registries:
I have tested edge version @angular/cli@6.2.0-beta.3, and same issue. This is a serious bug that will prevent our organisation from upgrading to angular 6.
Please fix asap!
Still failing with
6.1.3:We have the same issue now. Does anyone have a solution for this problem?
Same problem here behind a private Nexus repo
Experiencing this issue with
@angular/cli@6.0.3and private Nexus repositoryContent of
.npmrclooks something like…This should now be addressed in 7.3.0+. If anyone is still encountering problems, please open a new issue detailing the issue.
@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/cli@7.1.1
Edit: It has landed now. Enjoy it!
It works now using rc.0 and
Not a solution but a workaround 😃
In additional to the previous PR mentioned above (which is currently available in the 7.1.0.beta.1). Further improvements will be present in the next beta via https://github.com/angular/angular-cli/pull/12871. This PR provides improved discovery of
.nmprcfiles.Same here with @angular/cli 6.2.1
Our workaround was to remove our private package, then run…
ng update --registry=https://registry.npmjs.org/ @angular/cliand then re-install the private package.
The worst? Or simply the worst? The worst.
This should be fixed sooner than later
In our npmrc we have options like strict-ssl and always-auth which are boolean values when being parsed. The update script in npm.ts tries to call ‘replace’ on the options and fails when the function does not exist (which it doesn’t for bools):
options[key] = options[key].replace(/\$\{([^\}]+)\}/, (_, name) => process.env[name] || '');We fixed this by checking if the function exists before trying to call it. PR is attachedNow, ng update works as expected also with our private Artifactory
@catull well
.npmrcisn’t used when having a git dependency. it’s just a line like this:in the
package.json. No package repo is involved.fyi
Tested
7.1.0-rc.0but still get404 Not Found - GET https://registry.npmjs.org/@myScope%2fmyPackage - Not foundwhere the URL should point to a private registryHi @Ionaru @evanjmg @PMoransais
could you try to add to your .npmrc the following line?
or / and
Does this help?
The fix by @smnbbrv did not work for me, I still got
401 Unauthorizedwhen runningng update @angular/cli @angular/core.My .npmrc is really simple:
I had to remove the
.npmrcfile and all private packages inpackage.jsonto runng update. 😦Not when private registry requires credentials.
Really angular team…still no fix for this?! Stop developing any new stuff and fix this issue. I have same issue, except I don’t use private packages, nexus is used as a proxy for ALL npm repositories. So removing .npmrc doesn’t solve anything (npm requests must go through the nexus proxy or they don’t leave the network), and there is no “private dependencies” to remove, because they are all legit packages …like angular stuff…
still the same issue with @schematics/update@0.7.2 and @angular/cli@6.1.2
Workaround that works for me:
my hack/solution:
go to
node_modules\@schematics\update\update\npm.jsand change line 35-ish (first line of the method)Not sure why it’s not getting the setting from the .npmrc file, but this let me get past the issue
even in official 6.1 it’s still an issue
Any chance the cli could just log not found errors as a warning instead of exiting on them?
I’m also curious, is there anything we can do or provide to speed this issue up?
@hansl any update on this? The issue still carries the “need: more info” label.
Same here, happens with our own private repo
ng updatereturnsNot found: @org/packagealthoughnpm install @org/packageworks fine and the package is already installed innode_modules.Currently with
7.3.0for me it works correctly again.@Chklang did you try with
ng update --registry https://privaterepo.mycompagnie.fr/npm/?This is not only a problem with private repos but in my case also a problem with dependencies from git repos (so not npm based)
Update: after upgrading to 7.2.0-beta.1 message slightly changed but issue persist:
@alan-agius4
This is my output:
Is there an article describing what to do know? Im using Windows and don’t know how to get it working:
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-angularWith 7.1.1 I get 404 errors again. Scoped packages seams not to be recognized correctly.
@smnbbrv
ng updatestill doesn’t work for me. the .npmrc is in the same directory as the angular.json and containsalways-auth=trueand an artifactory url forregistry. there is also the~/.npmrcwhich contains the_authToken. i’m using yarn aspackageManagerbut however also removed thepackageManagerconfig fromangular.jsonto use npm. installation and updating of dependencies via npm and yarn works fine (so auth data should be correct). it takes some time and outputs thenThis request requires auth credentials. Run npm login and repeat the request.. Angular CLI version 7.0.2, yarn version v1.10.1. any suggestions?It might work for font-awesome (i wouldn’t know i dont use it), but it still doesn’t work for a npm proxy that has authentication. E.g when you have a nexus server keeping a “local” (to the office network cache) of the default npm repository - there where all the public stuff like angular gets downloaded from by default (explained in my previous https://github.com/angular/angular-cli/issues/10624#issuecomment-421544428)
Steps to reproduce:
ng upgrade2.1) Even try `ng upgrade --registry=https://nexus.myorg.com/repository/npm"After waiting quite a while it errors with “This request requires auth credentials. Run
npm loginand repeat the request.” Looking at my nexus logs I can see it never even attempted to download from the registry.Because
ng updatedoesn’t have a--verboseoptions, I can’t really tell where it is trying to download from…Works for me ! Thanks @smnbbrv !
@SV-efi You can probably just change the
@angular/...packages to a newer6.X.Xversion and runnpm installto fix your issue.Tested updated script from comment above, works 👍Nice one @smnbbrv!
@hansl any idea when this will be released?
@mrmaxsteel could you please check the following:
Thanks for collaborating! 👍
@dkabul the fix is not merged yet
+1 this really needs a resolution. Due to this issue we have missed our window to upgrade and have to wait till next release cycle in several months time 👎
@ankemp Right! We are also blocked to perform the update to ^6.1.0
@blueiceprj solution might work for one off private repos, but not when your corp caches/replicates npm on jFrog Artifactory.
delete
node_modulesand runng upgrade @angular/coreit works for me
@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-rc0of the@angular/clipackage, before editing thenpm.jsfile as suggested.What PR do you suggest to create, one that fixes the issue in
npmitself, or one that ‘patches’ it in CLI by fetching it somehow from.npmrcand adding it in manually?Hi Guys,
The issue related with npm’s get config command itself.
npm get <key>returns all other configs except_authand_authToken. Even,npm config listdoesn’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
I’ll try to create PR for this if anyone created anything similar.
Cheers
Having the same issue using a JFrog Artifactory (universal artifact manager) as registry in
.npmrc. This may be related: https://github.com/angular/devkit/issues/917