lerna: Lerna does not support yarn 2 workspace:* url type
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 |
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 45
- Comments: 17 (2 by maintainers)
Commits related to this issue
- 🐛 fix package references Until lerna/lerna#2564 is revolved — committed to dennisreimann/uiengine by dennisreimann 3 years ago
- build(ts,tsx): Revert `workspace:` protocol It seems like lerna doesn't support them. See https://github.com/lerna/lerna/issues/2564. This reverts commit dfbd99137c0816154bad0ce8a83aa5ed6720a1f4. Th... — committed to NiGhTTraX/eslint-config by NiGhTTraX 2 years ago
Waiting for this feature too 👍
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.
I’m having the same issue. I’m using pnpm and my
lerna publish ...
is failing due to an “unrecognised dependency URLworkspace:*
”.It’s actively being worked on as we speak, and will complement similar updates for pnpm support in #3284
Now that Lerna is taken over by Nx, will this get fixed in the forseeable future?
@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 theworkspace:
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:
protocolCheers and happy coding
Any workaround for this? Kinda surprising that this hasn’t been looked at given the amount of users of both projects 😕
There is WIP PR https://github.com/lerna/lerna/pull/2450
Hi Folks, I’m going to close this one as
lerna
fully supports theworkspace:
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!
pnpm update
will also set the version range string to useworkspace:
, 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?@rhyek a workaround is to replace the build command in package.json with
package.json
instead of
lerna run build
so lerna won’t complaint about the yarn 2 workspace:* url typee.g.
ui: workspace:packages/ui
@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