dream2nix icon indicating copy to clipboard operation
dream2nix copied to clipboard

yarn-lock: using relative path for "file:" in a workspace's subpackage probably won't match yarn.lock's reference to it

Open tgunnoe opened this issue 3 years ago • 2 comments

I made an example repository: https://github.com/tgunnoe/d2n-workspace-package-files-example/

In a workspace subpackage's package.json, a dependency referencing a relative path will not find what yarn resolves it as in its own yarn.lock

The error is:

error: attribute '@cardano-sdk/core@file:../../cardano-js-sdk-9ca2361c+asset_patch+multiasset/cardano-sdk-core-0.2.0.tgz' missing

       at /nix/store/1k8ddwrr1h3x3d158mv87v4kki2pvxr5-source/src/subsystems/nodejs/translators/yarn-lock/default.nix:70:27:

           69|               yarnName = "${depName}@${semVer}";
           70|               depObject = objectsByKey.yarnName."${yarnName}";
             |                           ^
           71|             in

I don't know yet the best way to fix this. Should the parser change the attribute name to match how yarn resolves it? @DavHau thoughts on that?

tgunnoe avatar Aug 11 '22 16:08 tgunnoe

local .tgz files as package sources are currently not supported by the translator and the builder. Support for that could be added in the framework.

As a current workaround, you could patch your projects source, to not contain a .tgz file and instead depend a version fo that dependency which is hosted on npmjs.org or similar repos.

DavHau avatar Aug 13 '22 09:08 DavHau

Oh, I suppose I didn't even get to that point to see that. Good to know! I think local references to unpacked projects would still encounter this error? I'll check it out.

tgunnoe avatar Aug 15 '22 13:08 tgunnoe

This will probably be solved by fixing https://github.com/nix-community/dream2nix/issues/307

DavHau avatar Nov 09 '22 20:11 DavHau