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

I think I found it...very much hidden I'd say. For me the issue was the LOCATION of the .npmrc file. Angular does not search for the file in the default location on windows. Normally the file is in C:\Users\username\.npmrc instead Angular searches for the file in C:\Users\username\AppData\Local\.npmrc. Copying the file to there solved my issue. Now just to remember that every change I make to the normal location of npmrc - like when using npm cli to add repos - to copy that file to where Angular is looking for it

I tried a symlink in the AppData/Local dir pointing at the User directory, and it didn't change the error.

joshvito avatar Nov 09 '18 22:11 joshvito

Is there a timeline for a fix? I'm not in a hurry to upgrade to 7 so I'd rather wait for the right fix instead of playing around with the workarounds.

marc-wilson avatar Nov 09 '18 22:11 marc-wilson

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 .nmprc files.

clydin avatar Nov 13 '18 15:11 clydin

fyi

Tested 7.1.0-rc.0 but still get 404 Not Found - GET https://registry.npmjs.org/@myScope%2fmyPackage - Not found where the URL should point to a private registry

Angular CLI: 7.1.0-rc.0
Node: 10.13.0
OS: win32 x64
Angular: 7.0.1
... animations, cdk, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

Package                            Version
------------------------------------------------------------
@angular-devkit/architect          0.10.3
@angular-devkit/build-angular      0.10.3
@angular-devkit/build-ng-packagr   0.10.3
@angular-devkit/build-optimizer    0.10.3
@angular-devkit/build-webpack      0.10.3
@angular-devkit/core               7.0.3
@angular-devkit/schematics         7.1.0-rc.0
@angular/cli                       7.1.0-rc.0
@angular/flex-layout               7.0.0-beta.19
@ngtools/json-schema               1.1.0
@ngtools/webpack                   7.0.3
@schematics/angular                7.1.0-rc.0
@schematics/update                 0.11.0-rc.0
ng-packagr                         4.4.0
rxjs                               6.3.3
typescript                         3.1.3
webpack                            4.23.1

kroeder avatar Nov 15 '18 09:11 kroeder

@kroeder Can you provide the path to the .npmrc file that contains the relevant settings?

clydin avatar Nov 15 '18 14:11 clydin

Hey, sorry for the late response

Default directory C:\Users\%username%\.npmrc

Contains

registry=https://%registry%/repository/%npm-group-name%.npm.group/
//%registry%/repository/%npm-group-name%.npm.group/:_authToken=%auth-token%
//%registry%/repository/%npm-group-name%.npm.releases/:_authToken=%auth-token%

%...% are not part of the content, I just replaced the actual values with %-placeholders

We use: Nexus https://blog.sonatype.com/using-nexus-3-as-your-repository-part-2-npm-packages

kroeder avatar Nov 19 '18 14:11 kroeder

@kroeder if you have some time, could you put that .npmrc file in your project's directory and try running update?

@mswilson4040 are you on windows as well?

clydin avatar Nov 19 '18 15:11 clydin

@clydin I am on a mac.

marc-wilson avatar Nov 19 '18 16:11 marc-wilson

@mswilson4040 did you receive the same result when trying the 7.1 RC? Also could you provide the path to the relevant .npmrc as well?

clydin avatar Nov 19 '18 17:11 clydin

@clydin I haven't tried 7.1 yet. I eventually just removed the npmrc and all my modules, ran ng update and then put everything back in. For the npmrc file path, I have two locations. One location in my home directory (which has my auth token) and then another one at my project directory root (registering the priate repo).

  • .npmrc path in home dir: (/Users/{username})
  • .npmrc in project dir: (/Users/{username}/dev/{projectname}/wwwroot/clientapp)

marc-wilson avatar Nov 19 '18 18:11 marc-wilson

Still not working. Tested with 7.0.6 and 7.1.0-rc.0

After i installed a private package from a private repository the ng update command failed always with: 404 Not Found: @myprivatescope/my-private-package

npmrc:

registry=https://stage.privateRepository/

@myprivatescope:registry=https://stage.privateRepository/
//stage.privateRepository/:_password=<MY TOKEN>
//stage.privateRepository/:username=<MY USERNAME>
//stage.privateRepository/:email=<MY EMAIL>
//stage.privateRepository/:always-auth=true

danielleroux avatar Nov 21 '18 06:11 danielleroux

@danielleroux have you tried https://github.com/angular/angular-cli/issues/10624#issuecomment-439943098

Still had no time to test this..

kroeder avatar Nov 21 '18 06:11 kroeder

@kroeder yes, but i get the same error.

OS: macOS

//EDIT:

It works with 7.1.0-rc.0 only updated the global module not the package module of the cli.

Tested with .npmrc in project root and userfolder

danielleroux avatar Nov 21 '18 07:11 danielleroux

Cannot confirm, what exactly have you done to get it work? I tested Global 7.1.0-rc.0 / Local ~7.0.0 => "Unauthorized" Global 7.1.0-rc.0 / Local ^6.0.0 => "Unauthorized" Global 7.1.0-rc.0 / Local 7.1.0-rc.0 => "404 Not Found: https://registry.npmjs.org/@myprivatescope/my-private-package" Global 7.1.0-rc.0 / Local 7.1.0-rc.0 / .npmrc in project-root => "404 Not Found: https://registry.npmjs.org/@myprivatescope/my-private-package"

kroeder avatar Nov 21 '18 13:11 kroeder

After: Global 7.1.0-rc.0 / Local 7.1.0-rc.0 => 401 Unauthorized - GET https://npm.fontawesome.com/@fortawesome%2ffontawesome-svg-core all in red

Before: Global 7.0.6 / Local 7.0.6 => "401 Unauthorized", also all in RED This has been consistently with ng CLI versions < 7.1.x

My local .npmrc in the project - don't have one in the home directory!:

@XXXXXXXXXX:registry=https://artifactory.YYYYYYYYYYY: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

catull avatar Nov 21 '18 14:11 catull

Environment variable replacement is not currently supported (i.e., ${NPM_TOKEN_FONTAWESOME} will stay as is). Support is currently in development.

clydin avatar Nov 21 '18 16:11 clydin

@clydin You are spot-on, as usual.

If I add the token verbatim, ng upgrade actually works.

As I do depend on an internal framework to first upgrade to Angular 7 - it is based on 6.1 -, I am not in a hurry to upgrade the code base to 7 yet.

Thanks for clarifying it.

catull avatar Nov 22 '18 05:11 catull

🤔 Is it windows or why doesn't it work with my project?

kroeder avatar Nov 22 '18 06:11 kroeder

@kroeder

Your current C:\Users%username%.npmrc is

registry=https://%registry%/repository/%npm-group-name%.npm.group/ //%registry%/repository/%npm-group-name%.npm.group/:_authToken=%auth-token% //%registry%/repository/%npm-group-name%.npm.releases/:_authToken=%auth-token%

Have you tried

registry=https://%registry%/repository/
//%registry%/repository/:_authToken=%auth-token%

Since we do not know what %npm-group-name% actually means/looks like.

Is it comparable to:

@fortawesome:registry=https://npm.fontawesome.com/
//npm.fontawesome.com/:_authToken=XXXXXXX

?

catull avatar Nov 22 '18 07:11 catull

You might want to check http://codeheaven.io/using-nexus-3-as-your-repository-part-2-npm-packages/

I have no deep knowledge, I just use it. Anyway: Using registry=https://%registry%/ and then ng update @angular/core prints an HTML-Document to the console because this is the URL to the nexus web interface and the actual repo is in a sub-directory

kroeder avatar Nov 23 '18 09:11 kroeder