Yarn workspaces with absolute path

376 Views Asked by At

I am using yarn 1.22.19, my package.json file contains

  "workspaces": [
    "/some/path/packages/*"
  ],

When I run yarn install it doesn't create symlink for the packages under that path. I also tried to delete yarn.lock but it didn't help.

The packages I want to link are not under the project's sub-tree.

Is it possible?

1

There are 1 best solutions below

1
morganney On BEST ANSWER

The defined workspaces must be descendants of the workspace root.

source

Workspaces must be descendants of the workspace root in terms of folder hierarchy. You cannot and must not reference a workspace that is located outside of this filesystem hierarchy.

So if your workspace root is located somewhere along the path /some/path/packages/*, for example at /some/path, then absolute paths should work. However, with this structure requirement there is no need to use absolute paths and you can define the workspaces as packages/*.