Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lerna does not support yarn 2 workspace:* url type #2564

Closed
suedama1756 opened this issue May 1, 2020 · 17 comments
Closed

Lerna does not support yarn 2 workspace:* url type #2564

suedama1756 opened this issue May 1, 2020 · 17 comments
Labels
scope: package management Issues with the bootstrap/add/link commands that relate to package management

Comments

@suedama1756
Copy link

Lerna does not seem to support the new workspace:* version schema used in yarn2. This seems really strange to me given that the yarn documentation mentions Lerna immediately after the section in the documentation on workspace:* so I may be missing something here.

Expected Behavior

I would expect Lerna to understand this dependency format and resolve to the local workspace copy of the package.

Current Behavior

Lerna: ERR! Error: unsupported url type "workspace:": "workspace:*"

Steps to Reproduce (for bugs)

Create a simple repo using yarn 2 with packages a and b

Run

yarn workspace a add b@workspace:*

Run lerna version

Your Environment

Executable Version
lerna --version 3.20.2
yarn --version 2.0.0-rc.33
node --version 12.16.1
OS Version
NAME VERSION
Windows 10 17763
@7rulnik
Copy link

7rulnik commented May 26, 2020

There is WIP PR #2450

@hyperupcall
Copy link

glad to see some progress on this! - i'll add that this also occurs when using pnpm workspaces, since they use the same workspace protocol

@zslucky
Copy link

zslucky commented Sep 28, 2020

Waiting for this feature too 👍

@Kizmar
Copy link

Kizmar commented Oct 8, 2020

In the mean time... Is there any difference between using "workspace:..." vs "file:..."?

@rhyek
Copy link

rhyek commented Jan 27, 2021

Any workaround for this? Kinda surprising that this hasn't been looked at given the amount of users of both projects :/

@hyperupcall
Copy link

@rhyek babel used to have some patches related to this if (ex. https://github.com/eankeen/babel/tree/72712f236b52ae8db27e03a08a59ced08b23efef/.yarn-patches/%40lerna). what i did is use some of those patches, change them a bit to work with patch-package, and do that. unfortunately, i don't have those modified patches as of now, but everything worked fine back then

@rfl8
Copy link

rfl8 commented May 27, 2021

@rhyek a workaround is to replace the build command in package.json with

package.json

   "build": "yarn workspaces foreach run build"
   ...

instead of lerna run build so lerna won't complaint about the yarn 2 workspace:* url type

e.g. ui: workspace:packages/ui

@ryanrhee
Copy link

pnpm update will also set the version range string to use workspace:, which will make subsequent calls to lerna fail. @suedama1756 maybe you can update the title to include pnpm so it's clear that this issue is not limited to yarn?

@tl-NASEEBULLAH-AHMADI
Copy link

tl-NASEEBULLAH-AHMADI commented Feb 10, 2022

I'm having the same issue. I'm using pnpm and my lerna publish ... is failing due to an "unrecognised dependency URL workspace:*".

@osteele
Copy link

osteele commented Feb 11, 2022

Until this issue is resolved, would it make sense to remove this text from https://yarnpkg.com/features/workspaces#yarn-workspaces-vs-lerna? It is so far as I can tell factually incorrect.

If there is some sense in which it is correct, maybe there is some improvement to the wording that doesn't have the same risk of misleading users into thinking some things will work that don't.

Despite the appearances, the Yarn workspaces and Lerna don't compete. In fact, Lerna will use Yarn's workspaces if possible. In a sense, you can see Lerna as a high-level layer on top of the low-level Yarn implementation.

@weiwei
Copy link

weiwei commented Jul 11, 2022

Now that Lerna is taken over by Nx, will this get fixed in the forseeable future?

@harrytran998
Copy link

I'm having the same issue. I'm using pnpm and my lerna publish ... is failing due to an "unrecognised dependency URL workspace:*".

We have the same issue as that. But seem the Nx team might be doesn't prioritize this issue 😄. So might be we must use another approach like the native pnpm publish 😄.

@ghiscoding
Copy link

ghiscoding commented Jul 20, 2022

@weiwei @harrytran998 and everyone else...
As a possible alternative, you can use Lerna-Lite, that I forked before Nrwl came in, the commands are the same and I added support for workspace: protocol for well over 2 months now, I also migrated the project itself to pnpm (it works with yarn too) and I also use the workspace: protocol within the project, it makes it easier to test the code and to make sure everything is running as expected... there are a few large projects that are already using this feature. I also keep PRs in sync with Lerna so it doesn't fall behind.

I'm sure that Lerna will eventually bring the feature but for now Lerna-Lite is a good alternative and it works pretty well with the workspace: protocol

Cheers and happy coding

@hustcer
Copy link

hustcer commented Jul 23, 2022

Now that Lerna is taken over by Nx, will this get fixed in the forseeable future?

Hope this can be fixed asap

@pats
Copy link

pats commented Aug 18, 2022

Are there any plans for fixing this issue?

@JamesHenry
Copy link
Member

It's actively being worked on as we speak, and will complement similar updates for pnpm support in #3284

@JamesHenry
Copy link
Member

Hi Folks, I'm going to close this one as lerna fully supports the workspace: specifier for yarn 1, yarn 2+ (using the node_modules linker) and pnpm.

If you run into any issues please feel free to open a new issue with as much context as possible.

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: package management Issues with the bootstrap/add/link commands that relate to package management
Projects
None yet
Development

No branches or pull requests