Skip to content
This repository has been archived by the owner on May 20, 2021. It is now read-only.

Wrong packages being used when running yarn #150

Open
purefn opened this issue Jun 19, 2020 · 1 comment
Open

Wrong packages being used when running yarn #150

purefn opened this issue Jun 19, 2020 · 1 comment

Comments

@purefn
Copy link

purefn commented Jun 19, 2020

I've got an SPA that I'm trying to build and can't quite get things worked out right. tslint and tsc fail when run with nix but are fine when I run yarn directly. After a bit of investigating, it appears to be a problem with the wrong versions of packages being used in the nix build.

It's a small subset of dependencies: date-fns, query-string, and a few others. I can't determine why these specifically are being singled out. I did some experimenting and found that, during the yarn install to create the yarn modules derivation, there is a /build/node_modules directory that is populated and a /build/deps/${pname}/node_modules directory that is created.

/build/node_modules contains all the dependencies of my package, with incorrect versions of date-fns, query-string and others.

/build/deps/${pname}/node_modules contains only subset of packages that have incorrect versions in build/node_modules, but has the correct versions of those packages.

I'm not doing anything out of the ordinary in my derivation

   client = mkYarnPackage {
      name = "portal-client";
      src = ../client;
      packageJSON = ../client/package.json;
      yarnLock = ../client/yarn.lock;

      postConfigure = ''
        substituteInPlace deps/$pname/tslint.json \
          --replace './node_modules/fp-ts/rules' "$node_modules/fp-ts/rules"
      '';

      buildPhase = ''
        yarn run build_qa
      '';
    };

Is there something different I should be doing?

@purefn
Copy link
Author

purefn commented Jun 20, 2020

The problem seems to be with the package.json that is put in /build. If I replace it with my actual package.json things work correctly. Possibly because there is also a workspace defined in mine and nested workspaces aren't supported?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant