Using Sonatype Nexus with Yarn (npm replacement)

If you use a Nexus server (an internal proxy or custom NPM repository), yarn currently doesn’t work quite correctly.

To use your server, you need to do this:

vi ~/.yarnrc

Add this:

registry "http://myserver:8081/nexus/content/groups/npm-all//"

The double slashes are important. If you have internal NPM libraries, you’ll need three things configured in Nexus: a proxy to NPM central, your private NPM, and a grouping proxy. Note that the order in the grouping is important, as you may or may not want packages locally named the same as in NPM central.

If you don’t set this up correctly, you get errors like this:

error Couldn't find package "q" on the "npm" registry.
error Couldn't find package "backbone" on the "npm" registry.
error Couldn't find package "react" on the "npm" registry.
error Couldn't find package "moment" on the "npm" registry.

If you want a good Javascript book, I got a lot out of Secrets of the Javascript Ninja.

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *