Search code examples
node.jsnode-modulesyarnpkgyarn-workspacesyarnpkg-v2

Yarn unable to add packages (both inside and outside workspaces)


Yarn unable to add packages (both inside and outside workspaces)

Hi there, I'm using Yarn 2, I don't seem to be able to install any package. I always get the following formatted error:

$ yarn add useful-package

➤ BR0027: useful-package@unknown can't be resolved to a satisfying range
➤ Errors happened when preparing the environment required to run this command.

I have tried both inside a project that uses yarn's workspaces and outside in another test project.

This occurs with any package I try and Googling around I can't seem to find any relevant hits yet for this error message here.

What do you reckon the issue may be?

Best, Matt


Solution

  • Turns out I'd hit a Node JS version conflict with Yarn 2.

    Make sure to use latest Yarn (berry/2) with a node version V10.19.0 or greater.

    I hope this helps someone!

    Best, Matt