Juan Garcia
Juan Garcia

Reputation: 59

Not able to install npm packages after placed the private `.npmrc` file in Azure

I'm not able to install packages from npm, since I have placed a .npmrc file for install a private library. This library is hosted by azure work space. So i just placed the new config file to install. And it works fine in localhost.

How can i keep 2 registry in nprmc file, one for private and another one of npm registry?

error 404 Not Found - GET https://registry.npmjs.org/mm-core - Not found

mm-core is my private library hosted in azure, without my .npmrc file i receive this error.

With .npmrc file npm packages can't be installed.

any help?

Upvotes: 1

Views: 1849

Answers (1)

LoLance
LoLance

Reputation: 28216

It actually should work if you follow the official documents correctly. And we don't need to keep 2 registry in nprmc file, one for private and another one of npm registry.

Solution:

Keep the .npmrc file which presents the azure devops artifacts feed. And sign-in the azure devops web portal to configure the feed settings:

enter image description here

In feed settings, go Upstream sources and make sure you have npmjs as Upstream source. If it not exists, click the Add upstream source to add npmjs.

enter image description here

Then you only need to hold one registry for private library. If the package is not found in your private feed, since we've configured npmjs as upstream source, it will fetch the missing package there automatically!

More details about magic upstream source please refer to this document.

Upvotes: 1

Related Questions