svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
527 stars 100 forks source link

Error fetching package from NPM registry! #308

Open davidak opened 2 years ago

davidak commented 2 years ago

I'm following this tutorial, but get an error. https://kcode.co.za/install-npm-packages-on-nixos-with-node2nix/

node-packages.json

[
  "taler-wallet-cli"
]

https://npm.io/package/taler-wallet-cli

[davidak@gaming:~/code/nixos-config/packages/customNodePackages]$ node2nix -i node-packages.json
info attempt registry request try #1 at 4:07:16 AM
http request GET https://registry.npmjs.org/taler-wallet-cli
http 200 https://registry.npmjs.org/taler-wallet-cli
Error fetching package: taler-wallet-cli from NPM registry!

https://registry.npmjs.org/taler-wallet-cli

{"_id":"taler-wallet-cli","name":"taler-wallet-cli","time":{"created":"2021-01-22T14:50:39.959Z","0.8.1":"2021-01-22T14:50:40.258Z","modified":"2021-02-04T16:38:01.700Z","unpublished":{"time":"2021-02-04T16:38:01.700Z","versions":["0.8.1"]}}}
davidak commented 2 years ago

It works with

node-packages.json

[
  "@gnu-taler/taler-wallet-cli"
]

as documented here: https://docs.taler.net/taler-wallet-cli-manual.html#installation

So the documentation seem wrong.

The example at https://github.com/svanderburg/node2nix#deploying-a-collection-of-npm-packages-from-the-npm-registry.

davidak commented 2 years ago

I can't install the package:

nix-env -f default.nix -iA _at_gnu-taler_slash_taler-wallet-cli
error: attribute '_at_gnu-taler_slash_taler-wallet-cli' in selection path '_at_gnu-taler_slash_taler-wallet-cli' not found

That seem to be the correct name:

node-packages.nix

in
{
  "@gnu-taler/taler-wallet-cli" = nodeEnv.buildNodePackage {
    name = "_at_gnu-taler_slash_taler-wallet-cli";
    packageName = "@gnu-taler/taler-wallet-cli";
    version = "0.8.1";
    src = fetchurl {
      url = "https://registry.npmjs.org/@gnu-taler/taler-wallet-cli/-/taler-wallet-cli-0.8.1.tgz";
      sha512 = "D8qmuMHQQiTQneKntHJoMK7L6nd/Mq+5sHWCuYKIQShnMFCwnjaKffDOE8RtlDP1SePraK+DxiKVP8tdioZQZA==";
    };
    dependencies = [
      sources."@gnu-taler/idb-bridge-0.0.16"
      sources."@gnu-taler/taler-wallet-core-0.8.1"
      sources."@types/minimatch-3.0.5"
      sources."@types/node-14.18.33"
      sources."axios-0.21.4"
      sources."balanced-match-1.0.2"
      sources."big-integer-1.6.51"
      sources."brace-expansion-1.1.11"
      sources."buffer-from-1.1.2"
      sources."cancellationtoken-2.2.0"
      sources."concat-map-0.0.1"
      sources."fflate-0.6.10"
      sources."follow-redirects-1.15.2"
      sources."minimatch-3.1.2"
      sources."source-map-0.6.1"
      sources."source-map-support-0.5.21"
      sources."tslib-2.4.1"
    ];
    buildInputs = globalBuildInputs;
    meta = {
      description = "";
      license = "GPL-3.0";
    };
    production = true;
    bypassCache = true;
    reconstructLock = true;
  };

Adding the version does also not work:

[davidak@gaming:~/code/nixos-config/packages/customNodePackages]$ nix-env -f default.nix -iA '"_at_gnu-taler_slash_taler-wallet-cli-0.8.1"'
error: attribute '_at_gnu-taler_slash_taler-wallet-cli-0.8.1' in selection path '"_at_gnu-taler_slash_taler-wallet-cli-0.8.1"' not found

Not even this package with a one word name can get installed:

[davidak@gaming:~/code/nixos-config/packages/customNodePackages]$ nix-env -f default.nix -iA axios
error: attribute 'axios' in selection path 'axios' not found
davidak commented 2 years ago

I get the same error when putting it in nixpkgs following 17.19.5.1. Adding and Updating Javascript packages in nixpkgs .

[davidak@gaming:~/code/nixpkgs]$ nix-build -A nodePackages.taler-wallet-cli
error: attribute 'taler-wallet-cli' in selection path 'nodePackages.taler-wallet-cli' not found
[davidak@gaming:~/code/nixpkgs]$ nix-build -A nodePackages._at_gnu-taler_slash_taler-wallet-cli
error: attribute '_at_gnu-taler_slash_taler-wallet-cli' in selection path 'nodePackages._at_gnu-taler_slash_taler-wallet-cli' not found