nixfromnpm icon indicating copy to clipboard operation
nixfromnpm copied to clipboard

improve version checker: Failed to generate expressions for 1 downstream dependencies css-select@>=1.3.0-rc0 <1.4.0

Open srghma opened this issue 7 years ago • 5 comments

When I do ... I have an error

nixfromnpm -f package.json -o nix --dev-depth 1
....
Writing package file at /home/srghma/projects/my-create-react-app/nix/nodePackages/my-create-react-app/0.0.1.nix
Generating package definition object in /home/srghma/projects/my-create-react-app/nix/nodePackages/default.nix
Failed to generate expressions for 1 downstream dependencies.
  css-select@>=1.3.0-rc0 <1.4.0
   Dependency of:
    [email protected] -> [email protected] -> [email protected] -> [email protected]
Failed to build because: NoMatchingVersion >=1.3.0-rc0 <1.4.0
No packages to build.

But following readme https://github.com/adnelson/nixfromnpm#troubleshooting-a-package-that-doesnt-build I can build package

 ✘  ~/projects/my-create-react-app   nixfromnpm ✚  npm install -g 'css-select@>=1.3.0-rc0 <1.4.0'
+ [email protected]
added 9 packages in 0.791s


 ~/projects/my-create-react-app   nixfromnpm ✚  nixfromnpm -o /tmp/nix-test -p '[email protected]'

 ~/projects/my-create-react-app   nixfromnpm ✚  ls -al /tmp/nix-test
total 4
drwxr-xr-x  4 srghma users 100 Jul  3 22:09 .
drwxrwxrwt 26 root   root  820 Jul  3 22:09 ..
-rw-r--r--  1 srghma users 269 Jul  3 22:09 default.nix
drwxr-xr-x  3 srghma users 160 Jul  3 22:09 nodeLib
drwxr-xr-x 10 srghma users 220 Jul  3 22:09 nodePackages

 ~/projects/my-create-react-app   nixfromnpm ✚  cat /tmp/nix-test/nodePackages/css-select/1.3.0-rc0.nix
{ buildNodePackage, nodePackages, pkgs }:
buildNodePackage {
    name = "css-select";
    version = "1.3.0-rc0";
    src = pkgs.fetchurl {
      url = "https://registry.npmjs.org/css-select/-/css-select-1.3.0-rc0.tgz";
      sha1 = "6f93196aaae737666ea1036a8cb14a8fcb7a9231";
    };
    deps = with nodePackages; [
      css-what_2-1-0
      nth-check_1-0-1
      domutils_1-5-1
      boolbase_1-0-0
    ];
    meta = {
      homepage = "https://github.com/fb55/css-select#readme";
      description = "a CSS selector compiler/engine";
      keywords = [
        "css"
        "selector"
        "sizzle"
      ];
    };
  }

How to prevent this?

srghma avatar Jul 03 '18 19:07 srghma

How to reproduce the issue

git clone https://github.com/srghma/my-create-react-app
cd my-create-react-app
git checkout nixfromnpm
nixfromnpm -f package.json -o nix --dev-depth 1 --no-cache

srghma avatar Jul 03 '18 19:07 srghma

@srghma a bug may exist, the semver rules don't have a very good specification sadly. However, it looks like css-select only has 1.3.0-rc0 and then 2.0.0 releases; so you can specify ==1.3.0-rc0 instead of a range.

Can you move this ticket to https://github.com/adnelson/semver-range?

ixmatus avatar Jul 03 '18 19:07 ixmatus

@ixmatus I cant specify ==1.3.0-rc0 range since its dependency of another package

srghma avatar Jul 03 '18 19:07 srghma

@srghma you can override that package pretty easily.

ixmatus avatar Jul 03 '18 19:07 ixmatus

I can, I can also copy output of nixfromnpm -o /tmp/nix-test -p '[email protected]' to packages list, but it's one time solution

srghma avatar Jul 04 '18 06:07 srghma