svanderburg / node2nix

Generate Nix expressions to build NPM packages
MIT License
501 stars 94 forks source link

Can not pinpoint dependency #141

Open Jomik opened 5 years ago

Jomik commented 5 years ago

I am using buildNodePackage with src set to https://github.com/meain/vim-package-info and I get the below error. I need to get the node_modules folder to build the vim plugin. I do similar here for a project that has a yarn.lock file. https://gitlab.com/Jomik/nur-expressions/blob/master/pkgs/vimPlugins/overrides.nix#L6

Error log ``` pinpointing versions of dependencies... WARNING: cannot pinpoint dependency: semver-utils, context: /nix/store/4y7x3ffaf8swrkbip91af0glm2nij8rz-node-vim-package-info-modules-2019-04-20-2019-04-20/lib/node_modules/vim-package-info WARNING: cannot pinpoint dependency: toml, context: /nix/store/4y7x3ffaf8swrkbip91af0glm2nij8rz-node-vim-package-info-modules-2019-04-20-2019-04-20/lib/node_modules/vim-package-info patching script interpreter paths in . npm ERR! cb() never called! npm ERR! This is an error with npm itself. Please report this error at: npm ERR! npm ERR! A complete log of this run can be found in: npm ERR! /build/.npm/_logs/2019-04-22T17_51_55_293Z-debug.log ```
svanderburg commented 5 years ago

Hi,

I don't exactly know how you are using node2nix, but if I create a JSON configuration file, such as:

[
  { "vim-package-info": "meain/vim-package-info" }
]

and use node2nix to generate expressions from it:

$ node2nix -i pkg.json

then I can successfully build the package as follows:

$ nix-build -A "vim-package-info-meain/vim-package-info"

I have to admin that I tried the development version. not the latest stable release. A new release should be there very soon!

Jomik commented 5 years ago

I switched to https://github.com/serokell/nix-npm-buildpackage instead. I was simply importing default.nix from here and then calling buildNodePackage with the attributes required. So I did not use the cli-tool, because that is not really the way I could use it, since I don't just need to build the nodejs package, I also had to wrap it in a vim plugin.

TLATER commented 3 years ago

I just ran into this; I'm fairly sure it's not a bug. This seems to happen when the package.json is out of sync with the package.lock (this can happen if nobody ever runs npm install or the generated package.lock isn't updated), and node2nix is asked to use a package.json.

In this scenario, node2nix seems to simply not install the given packages because it doesn't know which version to install, and throws this warning. Maybe this should become a fatal error, or the warning could be improved?