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
[question] Using yarn commands with non-published lerna dependencies #501
Comments
Ideally {
"name": "A",
"dependencies": {
"B": "file:../B"
}
} Update: The above
|
FYI this seems to work correctly with npm. |
If Adding |
@kschzt sorry can you elaborate? edit: ahh I think I know what you mean… npm currently doesn't process dependencies that are already satisfied, so it doesn't bother checking the registry for new versions of the unpublished package, thus doesn't error.
@evocateur Note there are no consumers of any of these packages other than themselves, they're not shared libraries, they're all components of a single app and internal to the monorepo. |
Also relevant to this issue is this npm/yarn RFC for changing the |
I've found the answer to the initial question to be 100% yes - I'm using it that way in the following. https://github.com/OasisDigital/many-to-many-angular I use neither |
@kylecordes: I don't quite understand how you managed to make yarn with lerna work with unpublished packages. 🤔 If I clone your repo, run
This error, I believe, is the subject of the problem @timoxley and me have: that it's not possible to manipulate package.json/yarn.lock through yarn if you have a lerna-managed, unpublished packages in your package.json. |
@ravicious tried latest version of lerna? |
Yeah, I'm on I updated both yarn and then learn in @kylecordes's project to the newest version and I still get this error. |
I think My bootstrap script looks something like this: {
"scripts": {
"bootstrap" "lerna init && lerna exec -- linklocal && lerna bootstrap --mutex=network"
…
}
} |
@jvivs I think that's more related to yarnpkg/yarn#2541 |
@timoxley: Thanks, I that the combination of yarn, linklocal & lerna indeed works. Though passing Initially I was confused by the mutex error and I wasn't sure if this combination of packages still works. |
@timoxley The case I'm running into is slightly different, and quite possibly more of a problem for greenfield projects than a project w/ existing published dependencies. I would love to be wrong here, but Edit: yarnpkg/yarn#2541 seems similar, but I don't think it's the exact issue we're running into yet... the issue we're having occurs before a package is published in the first place (i.e.: creating a new package in a lerna-managed repo + doing anything w/ |
@ravicious and others - yes, it is currently irritating to use in this way. The linklocal and mutex things help, though sometimes I just edit a package.json then re-bootstrap. Here is the heart of the matter: regardless of whether working with non-published packages, typically when using Lerna one does not want yarn/npm to ignore the local deps and go look at the web instead - because when developing, the local packages might be arbitrarily different from the published ones. Ultimately it may require a deeper integration between Lerna and Yarn or NPM to make all of this "just work". As things proceed, I expect that improvements for working with published packages will end up also improving things for unpublished packages. |
I think #425 may help with this since yarn can work with relative paths and lerna would still symlink them. |
This is solved with the
|
This thread has been automatically locked because there has not been any recent activity after it was closed. Please open a new issue for related bugs. |
Is it possible to use
npm
/yarn
withlerna
if you've got packages which are not published to any registry?e.g.
./packages/A
depends onB
, found in./packages/B
.B
exists solely for code sharing, is just an internal package.A
norB
to any registry.Currently, if you run any
yarn
command in./packages/A
e.g.yarn remove express
the command will fail becauseyarn
looks forB
andB
isn't published in any registry, thuserror Couldn't find package "B" on the "npm" registry.
Is there a way around this?
A way to specifylerna
dependencies outside of "dependencies" perhaps? Maybe I missed something in the instructions. Perhaps this use-case just isn't supported.edit: this seems like a
yarn
shortcoming really.At the moment my workaround is terrible; I'm manually removing all
lerna
managed dependencies frompackage.json
just prior to running commands likeyarn add
, then adding them back afterwards. This is truly not great.The text was updated successfully, but these errors were encountered: