1
votes

I created an .npmrc file that configured my to work with VSTS pacakge feed, but all my public dependencies won't install (you know, react, lodash ...)

Seems like once I configure .npmrc file to point to my private feed, all public packages are no longer accessible.

since npm, contrary to Nuget, does not support multiple package registries (here's a related SA question), i'm currently stuck with running npm install twice - once without and .npmrc file to get the public dependencies, and once with the .npmrc file to get the private.

Doesn't VSTS mirror / proxy the public registry? if not - am I expected to run npm install twice with 2 differenct versions of the .npmrc file?

2
Do you solve the issue after enable upstream sources?starian chen-MSFT
@starain-MSFT I actually worked around the issue by having my private packages scoped (i.e package name for my private packages would be something like @scope/package. I then configured my .npmrc to point to the vsts pacckage feed only for my @scope. so public packages would go to npmhs and my packages will go to my private vsts feed.rony l

2 Answers

2
votes

The easy way to deal with it is enable upstream sources for your feed. After this, it will look for package form npmjs.com if the package isn’t existing in your feed.

Use packages from npmjs.com

Another way is that you can specify registry in the command, for example: npm install -g vsts-npm-auth --registry https://registry.npmjs.com --always-auth false.

On the other hand, we can just add the feed to the project’s .npmrc file, not in user’s folder (c:\Users[username]), then it uses public registry if current context is in the other path.

0
votes

I don't have admin rights over the private npm feed. Also, vsts-npm-auth is only available for windows.

However, the private packages I use are scoped. Dependencies look something like this in package.json:

{
  ...
 "dependencies": {
  "@scope-name/package-name": "^1.0.1",
  ...
 }
}

Adding an scoped registry to .npmrc worked for me.

@scope-name:registry=https://npm.package.feed.com/registry