How to use Gemfury as a private npm registry in conjunction with Yarn?

1.2k Views Asked by At

We're trying to use Gemfury in conjunction with Yarn instead of NPM. We have configured the proxy registry URL and logged in which updated our .npmrc file:

//npm-proxy.fury.io/mycompany/:_authToken=foobar
registry=https://npm-proxy.fury.io/mycompany/

This configuration has been tested and works with NPM with both private packages in our Gemfury registry as well as packages publicly in the NPM registry. For example both of these process without a problem:

npm install express
npm install @mycompany/foobar

This configuration unfortunately does not work with Yarn at all, though. All public packages outside of our Gemfury account error on the install with something along the lines of:

error An unexpected error occurred: "https://npm-proxy.fury.io/ourcompany/express: bad_request".

Or

Error: Couldn't find package "output-file-sync@^2.0.0" required by "@babel/cli@^7.2.3" on the "npm" registry.

I'm hoping I'm just missing some sort of configuration step here for Yarn, but I've been digging through the documentation and nothing really seems like it should be any different to use Yarn instead of NPM.

Am I missing something here?

1

There are 1 best solutions below

1
On

After so many different configurations and so many intents I found a way that works for npm and yarn without any issue.

npm config set @mycompany:registry https://npm-proxy.fury.io/mycompany/
npm config set //npm-proxy.fury.io/mycompany/:_authToken=${GEMFURY_TOKEN}
npm config set always-auth true

Just replace ${GEMFURY_TOKEN} with your specific token.