| 12 Nov 2023 |
peter-lustig | when I just do npm run build locally | 13:36:51 |
peter-lustig | so it is not my applications fault | 13:36:57 |
Lily Foster | but wait does node . fail similarly? | 13:37:04 |
peter-lustig | the errors I sent come from cd /nix/store/... and then running node . | 13:37:29 |
peter-lustig | but when I build locally with npm run build, then cd buildand run node ., everything just works | 13:37:44 |
Lily Foster | yeah then you're build dir that you made in your derivation is busted | 13:37:45 |
Lily Foster | * yeah then your build dir that you made in your derivation is busted | 13:37:52 |
Lily Foster | hmmm | 13:37:55 |
Lily Foster | In reply to @peter-lustig:matrix.org but when I build locally with npm run build, then cd buildand run node ., everything just works can you share your derivation that you used to make the build dir? | 13:38:08 |
peter-lustig | In reply to @lily:lily.flowers can you share your derivation that you used to make the build dir? yes | 13:38:15 |
peter-lustig | devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_20
];
};
packages.${system}.default = pkgs.buildNpmPackage {
name = "build-my-application";
src = ./.;
npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
installPhase = ''
mkdir $out
cp -r build/* $out
'';
};
| 13:38:51 |
peter-lustig | there has to be some mistake in here that I did or something missing | 13:39:53 |
Lily Foster | In reply to @peter-lustig:matrix.org
devShells.${system}.default = pkgs.mkShell {
buildInputs = with pkgs; [
nodejs_20
];
};
packages.${system}.default = pkgs.buildNpmPackage {
name = "build-my-application";
src = ./.;
npmDepsHash = "sha256-mTpjBKTIJkYVj2jrH5lF/n3Axceak4L60ZDQECQhGew=";
installPhase = ''
mkdir $out
cp -r build/* $out
'';
};
what if you just installPhase = "cp -r build $out" instead of the mkdir and stuff? | 13:40:08 |
szucsitg | In reply to @lily:lily.flowers So I was meaning the actual like workspaces field in package.json We use that in package.json but I already struggled with that a little bit because not all of the folders within a workspace subfolder has package.json. And this is what I added to mkYarnPackage derivation. Each of them as mkYarnPackage | 13:41:13 |
peter-lustig | In reply to @lily:lily.flowers what if you just installPhase = "cp -r build $out" instead of the mkdir and stuff? same error | 13:41:23 |
Lily Foster | can you diff -r build /nix/store/xixmhd827wd95j6748xv3zyn5cf3kb9x-build-my-application from your local build? | 13:41:53 |
peter-lustig | good idea | 13:42:29 |
peter-lustig | In reply to @lily:lily.flowers can you diff -r build /nix/store/xixmhd827wd95j6748xv3zyn5cf3kb9x-build-my-application from your local build? oh yesus huge chunk of code | 13:43:07 |
peter-lustig | for differences | 13:43:10 |
peter-lustig | something seems to be completely different about them | 13:43:50 |
peter-lustig | do I maybe need to copy some additional stuff to $out Lily Foster ?
You will need the output directory, the project's package.json, and the production dependencies in node_modules to run the application. Production dependencies can be generated by copying the package.json and package-lock.json and then running npm ci --omit dev (you can skip this step if your app doesn't have any dependencies). You can then start your app with this command:
| 13:47:07 |
Lily Foster | In reply to @peter-lustig:matrix.org something seems to be completely different about them could you share at least a high-level overview of the differences? i mean do they just look different entirely when you ls each of them? | 13:48:02 |
peter-lustig | In reply to @lily:lily.flowers could you share at least a high-level overview of the differences? i mean do they just look different entirely when you ls each of them? nope, when I ls them they look exactly the same | 13:48:47 |
peter-lustig | same files | 13:48:49 |
peter-lustig | it is some internal stuff | 13:48:55 |
Lily Foster | how internal? like a few folders in or just the contents of the files themselves? | 13:50:14 |
peter-lustig | idk if this helps | 13:50:38 |
peter-lustig |  Download image.png | 13:50:42 |
peter-lustig | 🤣 | 13:50:56 |
Lily Foster | would you be open to zipping up both build dirs and sharing them? | 13:51:49 |