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
labextension link
does not correct dependencies of linked packages
#6109
Comments
Would you mind including the full logs (I'm not in a place where I can repro right now)? If you are worried about space concerns, you can make an expandable section with this markdown: <details><summary>Header text</summary>
<pre>
Lots of
output
go here
</pre>
</details> Header textLots of output go here |
I'm guessing this is also a duplicate of #5852 ? |
It's distinct from #5852 in that the failure is in a dependency of a local package. I can install Here's the output of the build:
|
I'm also experiencing this issue while attempting to develop an extension. I am also using a monorepo (with Lerna) and have the dependency structure:
I expect the following to work:
But I get:
What is the current best workaround/solution? Somewhat odd addendum, according to the build log, the command where
Running this command on its own works just fine, though it doesn't accomplish anything. I checked the |
Hmmm. The odd thing here is that unlike in your case, my dependency hierarchy is only two levels deep :).
I'm apparently not even having that happen! |
@quigleyj-mavenomics I've reproduced the issue (on a fork of your reproduction) with only two layers: https://github.com/DylanLukes/jlab-bundler-repro/tree/only-two-layers If even this simple case doesn't work (and it doesn't), it would seem |
In ipywidgets, we link all local dependencies in dependency order: https://github.com/jupyter-widgets/ipywidgets/blob/c592184935781d0787bf622bf1659279c4a8b531/dev-install.sh#L55-L58 |
I am also linking all dependencies (there's only one) in dependency order. The issue here appears to be that This is despite the entries in
The relevant
So it doesn't look like This happens with both |
Ah, I notice the @quigleyj-mavenomics mentions in the OP
That would explain it working for ipywidgets - we've published some version of those packages. |
Yup. I attempted using the |
My guess is that yarn is going out to the registry to check to see if it needs to update the resolved package? A pointer to a technical experiment: perhaps one of these yarn options is useful in this case:
|
Here's how I was able to get it to work with https://github.com/quigleyj-mavenomics/jlab-bundler-repro. The problem is that yarn sees the dependency in, for example, https://github.com/quigleyj-mavenomics/jlab-bundler-repro/blob/fb0cbfc62c253d1f068363ded6325672d9c40d7b/packages/bar/package.json#L5, and notices that it is a traditional dependency (no files, etc.), so it tries to fetch it from the registry in this yarn function. I tried instructing yarn to not reach out to the registry if it could satisfy packages from its local cache, but then the So we have to (a) get yarn to put the linked package in its local cache first, and then (b) tell yarn to use the local cache if it can. We can do (a) by just not doing Perhaps we should make |
I got it working with the following steps:
I was then able to run |
Thanks for following up @SgtPooki! We might be able to change the yarn config itself to fix this. I'll take a look when I am no longer 😷 |
@SgtPooki if you add this to the
|
@blink1073 Almost; adding |
Hmm, I'm not sure if offline will work with a clean cache. Can you please try:
|
@blink1073 I don't think prefer-offline is an actual option. are you proposing adding that option in the .yarnrc file and then running those commands? |
and now that I've got multiple unpublished packages that have dependencies on each other, yarn doesn't like this solution anymore. i'm going to try using verdaccio and see if that simplifies things.. |
@SgtPooki Using Once you've got it working you don't need to run |
I can also confirm that using a local registry proxy works. |
If anyone needs a workaround for this right now, here is some code to add switch the yarn registry to a local one: |
To add to @saulshanabrook's comment, in order to create a workaround, we had to follow a similar approach to that of @SgtPooki. Notably,
Often, if running a fresh build after having cleaned Jupyter or in a new environment, we'd encounter a
Typically, this was enough to resolve the build issue relating to unpublished packages. Once the above succeeded, we could use |
This is a rather complex bug, so I created a new repo to make reproduction easier.
https://github.com/quigleyj-mavenomics/jlab-bundler-repro
I have a set of packages being developed in a monorepo (a la Lerna). I have a dependency tree like:
To set them up on JupyterLab, I've linked them:
However, when building
package-a
, the builder is still hitting the NPM registry to check forpackage-b
andpackage-c
. If these aren't published, the build fails even though B and C are linked.To Reproduce
The repo I linked above includes a package structure like I've described, and has build instructions. Just clone it, link the packages, and try a build.
Expected behavior
What I'd expect is akin to what
yarn link
does: Once I've linked a package, the bundler should use that for all in-range version specifiers instead of hitting the registry.Additional context
There is a workaround which I describe in the repo above. Once the packages are published on a repo, the registry hits will succeed. It doesn't really matter what's on the registry since the linked packages will be used anyway. You can either publish them straight to NPM, or setup a private registry like Verdaccio. With private registries, you can add a line to your
yarnrc
to make Yarn use it for only a particular scope.Using the reproduction repo I've setup, this is what the build errors with:
Separately, it looks like even though this fails the build still attempts to continue, going as far as running
webpack
(which fails if webpack wasn't installed before the problematic package)The text was updated successfully, but these errors were encountered: