-
Notifications
You must be signed in to change notification settings - Fork 8
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
Dev dependencies missing from node_modules #147
Comments
I think the answer probably lies in |
I cloned the project and pointed to my local copy. After doing some sensible things to make sure dev dependency cleanup is skipped I still can't find dev dependencies in |
Are you sure they are not in the Is this a package you can share the source to? Or at least the |
My {
"private": true,
"name": "my-project",
"version": "0.1.0",
"dependencies": {
"borc": "^2.0.4"
},
"devDependencies": {
"css-loader": "^1.0.0",
"style-loader": "^0.23.0",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
}
} With the above, there's only a I'm currently doing this as a workaround: {
"private": true,
"name": "my-project",
"version": "0.1.0",
"_dependencies": {
"borc": "^2.0.4"
},
"_devDependencies": {
"css-loader": "^1.0.0",
"style-loader": "^0.23.0",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
},
"dependencies": {
"borc": "^2.0.4",
"css-loader": "^1.0.0",
"style-loader": "^0.23.0",
"webpack": "^4.21.0",
"webpack-cli": "^3.1.2",
"webpack-dev-server": "^3.1.9"
}
} |
@paulyoung I will try to reproduce with this over the weekend. |
@ixmatus thanks. You might run into the same issue I did in adnelson/nix-node-packages#40 |
I don't usually use the |
@ixmatus what do you normally do? I'm following the process in the README but |
@paulyoung I just don't use them. I override packages as I need to. I tried to reproduce with your
I'll be poking at this one throughout the day. |
@paulyoung hilariously, unrelated to your example project, I ran into an issue with |
@ixmatus any advice on how to do this is appreciated. Perhaps we could update the README? |
A fix (which I will put a PR out for soon) for this would be to ignore empty |
@paulyoung I can provide an example here. Overriding the derivations is pretty straight-forward and follows standard Nix derivation override idioms. Examples would be useful in the README though so I will see about creating a separate PR for that. |
Yes, I was planning to do this but haven't looked into much. As mentioned in adnelson/nix-node-packages#40, I think the intention is to do that already. I still think the fix would need to be made to |
@paulyoung here is a minimal working example of what we do, the following Nix expression is found in a file named { callPackage, coreutils, haskellPackages, makeWrapper,
nodejs-10_x, pkgs, runCommand }:
let
clobberPackageJSON = path: oldAttrs: {
derivationOverrides.patchPhase = (oldAttrs.patchPhase or "") + ''
cp ${path} package.json
'';
};
in
(import ./nodePackages {
nodejs = nodejs-10_x;
inherit pkgs;
}).override { overrides = nodePackagesNew: nodePackagesOld: rec {
# We clobber package.json files for the following node packages instead of
# using patch, because 1-line patchfiles over the entire contents is pretty
# much the same thing (when a package.json file isn't pretty-printed). Most
# of these hacks are to remove stuff like:
#
# "bin": "",
#
# from the toplevel.
terser-webpack-plugin = terser-webpack-plugin_1-1-0;
terser-webpack-plugin_1-1-0 = nodePackagesOld.terser-webpack-plugin_1-1-0.overrideNodePackage
(clobberPackageJSON ./terser-webpack-plugin_1-1-0.json);
};
} ... note that we had to "clobberPackageJSON" for the following packages:
|
FWIW I think I'm familiar enough with overriding fields in nix attribute sets and derivations but perhaps a bit confused since I followed the README and used |
Super helpful, thanks! |
Still going to keep this issue open since it's actually about missing dev dependencies 😄 |
And --- package.json 2018-12-13 16:48:17.000000000 -0600
+++ package.json 2018-12-13 16:41:02.000000000 -0600
@@ -7,7 +7,6 @@
"author": "webpack Contrib Team",
"homepage": "https://github.com/webpack-contrib/terser-webpack-plugin",
"bugs": "https://github.com/webpack-contrib/terser-webpack-plugin/issues",
- "bin": "",
"main": "dist/cjs.js",
"engines": {
"node": ">= 6.9.0 <7.0.0 || >= 8.9.0" |
Yes leave this open, I still have not reproduced your original issue description. |
@ixmatus I saw your comment about clobbering vs patching and I think I might want/need to patch anyway. How were you getting the non-pretty printed |
@paulyoung I was going to the package's github project and the tagged version, then copying the package.json and pretty printing it in Emacs before writing it. |
I must be doing something wrong since patching that way seems to have no effect. |
I'm doing this:
|
Shouldn't it be: terser-webpack-plugin_1-1-0 = nodePackagesOld.terser-webpack-plugin_1-1-0.overrideNodePackage (oldDrv: {
derivationOverrides.patches = (oldDrv.patches or []) ++ [
../patches/terser-webpack-plugin_1-1-0.patch
];
}); |
@ixmatus I know it's been a while but were you able to reproduce the issue? |
And to answer your previous questions, the docs say this: nixfromnpm/nix-libs/nodeLib/buildNodePackage.nix Lines 550 to 559 in aca2877
|
I think the issues with nixfromnpm/nix-libs/nodeLib/buildNodePackage.nix Lines 424 to 437 in 76775d2
|
@paulyoung sorry I've been inactive on this, but how about using Removing |
I generated nix expressions with the following command:
Despite dev dependencies appearing in
./nixfromnpm/nodePackages/default.nix
and./project.nix
, they are missing from thenode_modules
directory when I build using the generateddefault.nix
file.How can I make sure they are present in
node_modules
?The text was updated successfully, but these errors were encountered: