Using pnpm with Project IDX

Hey there,

I am trying to use my private repo with Project IDX and with pnpm. However, I keep running into situations that cause the Project IDX extension to hang and I am not sure why it keeps going wrong. By default, Project IDX tries to use npm with dev.nix for installing packages and for running the web preview but I prefer to use pnpm and so stopped this from happening and rewrote my dev.nix file to this:

{pkgs}: {
  channel = "stable-24.05";
  packages = [
    pkgs.nodejs_20
    pkgs.pnpm  
  ];
  idx.extensions = [
    
  ];
  idx.previews = {
    previews = {
      web = {
        command = [
          "pnpm"
          "next"
          "dev"
          "-H"
          "0.0.0.0"
          "-p"
          "$PORT"
        ];
        manager = "web";
      };
    };
  };
}

However, it keeps causing my project idx setup to hang and not work properly. Is there a guide as to how I can run my Nextjs project from my repo using pnpm or do I just use npm?

I tried adding on onStart block but the install command doesn’t seem to run - has anyone been able to get pnpm working?

  idx.workspace.onStart = {
        installDependencies = "pnpm install";
        default.openFiles = [ "app/page.tsx" ];
  };

Hmm. That is an interesting one. Let me flag this for our team to look into, but do anticipate a delay into us looking into this.

1 Like

It appears to work now for me after committing my config file to my repo (instead of just editing the config within IDX) :person_shrugging:

1 Like

That is even more bizarre. Thanks for this added data point. We’ll add that to our current investigation.