"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
I think I found it...very much hidden I'd say. For me the issue was the LOCATION of the
.npmrcfile. Angular does not search for the file in the default location on windows. Normally the file is inC:\Users\username\.npmrcinstead Angular searches for the file inC:\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.
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.
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.
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 Can you provide the path to the .npmrc file that contains the relevant settings?
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 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 I am on a mac.
@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 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)
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 have you tried https://github.com/angular/angular-cli/issues/10624#issuecomment-439943098
Still had no time to test this..
@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
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"
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
Environment variable replacement is not currently supported (i.e., ${NPM_TOKEN_FONTAWESOME} will stay as is). Support is currently in development.
@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.
🤔 Is it windows or why doesn't it work with my project?
@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
?
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