angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

"ng update" doesn't support private repos such as FontAwesome 5 Pro

Open bjornharvold opened this issue 8 years ago • 172 comments

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

bjornharvold avatar May 04 '18 02:05 bjornharvold

@Chklang did you try with ng update --registry https://privaterepo.mycompagnie.fr/npm/ ?

aguacongas avatar Dec 13 '18 07:12 aguacongas

@aguacongas that works for me! However, I shouldn't have to do that if the registry is declared in my .npmrc.

kpaxton avatar Dec 19 '18 12:12 kpaxton

@kpaxton You're lucky, that doesn't for me. But my private repo needs authentication. And I agree, we shouldn't have to do that.

aguacongas avatar Dec 19 '18 14:12 aguacongas

I also not lucky. I have also authentication set for my private registry and I am getting below error

Unable to authenticate, need: Basic realm="Artifactory Realm"

aniruddhadas9 avatar Jan 07 '19 22:01 aniruddhadas9

@Chklang did you try with ng update --registry https://privaterepo.mycompagnie.fr/npm/ ?

Do you know what does ng update --registry https://privaterepo.mycompagnie.fr/npm/ command do? Users having auth set in their private registry can directly do what this command does?

aniruddhadas9 avatar Jan 07 '19 22:01 aniruddhadas9

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 attached

Now, ng update works as expected also with our private Artifactory

joeson1 avatar Jan 09 '19 17:01 joeson1

Hi,

I had the same problem, because we are using Artifactory in our company. We store private repositories in it. So I had the same error when trying to use ng update.

But I can pass the parameter "-f" to force the update. I changed the names to give you an example what will happen with the force flag:

ng update @angular/cli -f
    Package not installed: "-f". Skipping.
    404 Not Found - Get https://registry.npmjs.org/@MYCORPORATE/MYREPO1 - Not Found
    404 Not Found - Get https://registry.npmjs.org/@MYCORPORATE/MYREPO2 - Not Found

After that all was installed and update. I did this with the Angular and CDK package as well. We are updated the internal packages for our own.

I hope this will help.

florian-kittel avatar Jan 14 '19 08:01 florian-kittel

PS: We also use https://www.npmjs.com/package/npm-check-updates with ncu command to check updates for our packages. This works well with Artifactory. So we now using ng update for all Angular related packages and ncu for other. But be careful and check if all new packages are working with the Angular packages.

florian-kittel avatar Jan 14 '19 09:01 florian-kittel

@florian-kittel Both npm and yarn have had the outdated option, check it out, it may satisfy your requirements. Works on public and private npm repos.

catull avatar Jan 15 '19 06:01 catull

Currently with 7.3.0 for me it works correctly again.

DaSchTour avatar Feb 05 '19 11:02 DaSchTour

This should now be addressed in 7.3.0+. If anyone is still encountering problems, please open a new issue detailing the issue.

clydin avatar Mar 13 '19 15:03 clydin

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.