Skip to content
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

Non npm deps #66

Open
dominicegginton opened this issue Feb 14, 2024 · 4 comments
Open

Non npm deps #66

dominicegginton opened this issue Feb 14, 2024 · 4 comments

Comments

@dominicegginton
Copy link

Hi. I am running into an issue with dependecies that I would like to install via npm but do not come from the npm package regersity.

For example xlsx is installed with the command: 'npm install https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz'.

This results in a package-lock.json entry of:

"node_modules/xlsx": {
  "version": "0.20.1",
  "resolved": "https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz",
  "integrity": "sha512-hA7SYmn/H3cJ1VGi7kmSKxbEXCEn5UVJlwYFSFXhLe54wPUvW+80TmR5l+TZh4nJCw8G/e0SuZUfvqlTIh40hw==",
  "license": "Apache-2.0",
  "bin": {
    "xlsx": "bin/xlsx.njs"
  },
  "engines": {
    "node": ">=0.8"
  }
}

When building with napalm I get the following output when napalm is installing deps:

npm ERR! request to https://cdn.sheetjs.com/xlsx-0.20.1/xlsx-0.20.1.tgz failed, reason: getaddrinfo EAI_AGAIN cdn.sheetjs.com

I wrote a minimal test example here (dominicegginton@ef77510) that follow the tests examples in this repositoty, to demintrate the issue im having (nix build github:dominicegginton/napalm#hello-world-non-npm-deps).

Any help would be much appricated.

@relief-melone
Copy link

relief-melone commented Feb 21, 2024

Probably related. I am currently trying to build a package to use as vimPlugin

{ pkgs, lib, napalm, ...}:
let
  inherit (pkgs.stdenv) mkDerivation;
  inherit (pkgs) fetchFromGitHub;

    src = fetchFromGitHub {
      owner = "microsoft";
      repo = "vscode-js-debug";
      rev = "1c26f2fb875eca49cbc75564fde6637ce3c1cf01";
      sha256 = "sha256-87NnKip5uSvQmDckVeHL9nPOSztYIqF4bLBSgC9JaV8=";
    };

 in
  pkgs.vimUtils.buildVimPlugin {
    name = "vscode-js-debug";
    src = napalm.buildPackage src {};
  }

Still in it's early stages but the error i can see looks pretty similar

npm ERR! errno EAI_AGAIN
npm ERR! request to https://codeload.github.com/connor4312/picomatch/tar.gz/2fbe90b12eafa7dde816ff8c16be9e77271b0e0b failed, reason: getaddrinfo EAI_AGAIN codeload.github.com

I started from this article here before it recommended napalm at the bottom :D
https://www.nmattia.com/posts/2022-12-18-lockfile-trick-package-npm-project-with-nix/
The reason I am mentioning this because following this approach the same package picomatch caused problems being a git+ssh source. Maybe that helps as well

Would also love to see this work. napalm seems to be really great. Thank you for the effort!

@relief-melone
Copy link

I have taken a look at the source code but unfortunately it's still above my current nix skill level. However I would suspect that the issue is somewhere when the buildPackage passes the pacakge urls to the napalm-registry and the way that handles those links internally (unfortunately latest at the point where we are in haskell I am completely lost)

@dominicegginton
Copy link
Author

dominicegginton commented Feb 22, 2024

@relief-melone many thanks for taking a look at this.

In the time since posting my issue I had already found the article you mentioned and looked through the src here, this lead to me deciding to create my own nix flake as I felt I would be reusing it often. It's very similar to napalm but forgoes the registry.

See: dominicegginton/noxide

@dominicegginton
Copy link
Author

@relief-melone I updated noxide with a test for non npm deps: https://github.com/dominicegginton/noxide/blob/main/default.nix#L247-L255

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants