microsoft / microsoft/nodejstools
Unable to authorize private NPM registry
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 1.8k
- Forks
- 355
- PR merge metrics
- No merged PRs in 30d
Description
I have a private NPM feed hosted on Visual Studio Team Service. I followed instruction on https://www.visualstudio.com/en-us/docs/package/npm/npmrc to setup the npmrc config.
After the setup, the registry URL and authorization token is stored in .npmrc file. I was able to run "npm install" command with success. However, I cannot list and install anything by using NTVS "Install new NPM package" window.
Expected Behavior
All packages in the registry will be listed
Actual Behavior
No package is listed.
An error shown "Refresh failed - see output below for details"

Full Stack Trace Below
System.Net.WebException: Remote server return error: (401) Unauthorized
On System.Net.HttpWebRequest.EndGetResponse(IAsyncResult asyncResult)
On System.Threading.Tasks.TaskFactory`1.FromAsyncCoreLogic(IAsyncResult iar, Func`2 endFunction, Action`1 endAction, Task`1 promise, Boolean requiresSynchronization)
--- End of stack trace from previous location where exception was thrown ---
On System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
On System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
On Microsoft.NodejsTools.Npm.SPI.NpmGetCatalogCommand.<DownloadPackageJsonCache>d__21.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
On System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
On System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
On Microsoft.NodejsTools.Npm.SPI.NpmGetCatalogCommand.<UpdatePackageCache>d__27.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
On System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess(Task task)
On System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
On System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd(Task task)
On Microsoft.NodejsTools.Npm.SPI.NpmGetCatalogCommand.<ExecuteAsync>d__23.MoveNext()
Environment
- NTVS Version: 1.3.41102.00
- Visual Studio Version: 15.0.0-RC4
- Node.js Version: 7.6.0
- NPM Version: 4.2.0
Steps to Reproduce
- Setup .npmrc with a private registry that require auth
- Open "Install new NPM Packages..." window
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the failure with a private authenticated registry using the .npmrc setup and the “Install new NPM Packages...” window. Start at Microsoft.NodejsTools.Npm.SPI.NpmGetCatalogCommand, especially DownloadPackageJsonCache and UpdatePackageCache, and trace how the registry request is authorized. Done means the window lists packages from the private registry without the 401 error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, nodejs
- Domain
- devtools, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100