[Nix-dev] NPM package - Bower dependency can't find dependency

Alex Berg chexxor at gmail.com
Wed Nov 26 05:28:22 CET 2014


I can't figure out this NPM stuff, and I don't want to keep spinning my
tires on this when the new npm2nix thing might fix this. I can't even
figure out how that tool is supposed to be used. I wish there was a
conceptual documentation page on the wiki or something.

As a workaround, I changed my shell.nix to manually inject the path I need
into the NODE_PATH env variable. I found the missing dependency by running
this command and just picking one.

    find /nix/store -type d -name es5-ext

Here is my new shell.nix


---------- shell.nix ------------

{ }:

with import <nixpkgs> {};

let haskellPackages = pkgs.haskellPackages.override {
        extension = self: super: {
                # purescript = self.callPackage ./purescript.nix {};
        };
};
nodePkgs = pkgs.nodePackages;
in rec {
        pursEnv = stdenv.mkDerivation rec {
                name = "purescript-env";
                version = "1.1.1.1";
                src = ./.;
                buildInputs = [
                        haskellPackages.purescript
                        nodePkgs.bower
                        nodePkgs.grunt-cli
                        git
                        which
                ];
                shellHook =
  ''
    echo "Patching NODE_PATH"
    export
NODE_PATH=$NODE_PATH:/nix/store/hhpwgi9k2j3c0r4q6rn0l0cf1r8vf98q-node-es5-ext-0.10.4/lib/node_modules
  '';

        };
}

On Sat, Nov 22, 2014 at 10:32 AM, Alex Berg <chexxor at gmail.com> wrote:

>
> I'm working on this today to narrow down where the issue lies, so I want
> to poll  other's progress on this. I believe it's related to propagated
> build-inputs.
>
> I am trying to use purescript, grunt, and bower. All are working fine, but
> bower is not. The error message is pasted below.
>
> What's the status of recursive dependency resolution for NPM packages? I
> remember seeing lots of work on it in the last 1-2 months.
>
> Looks like the "d" library can't find the "es5-ext/object/assign" library.
> I believe the latter is a part of the standard library, which I believe
> should be part of the base node package.
>
>
> ---------- shell.nix ------------
>
> { }:
>
> with import <nixpkgs> {};
>
> let haskellPackages = pkgs.haskellPackages.override {
>         extension = self: super: {
>                 # purescript = self.callPackage ./purescript.nix {};
>         };
> };
> nodePkgs = pkgs.nodePackages;
> in rec {
>         pursEnv = stdenv.mkDerivation rec {
>                 name = "purescript-env";
>                 version = "1.1.1.1";
>                 src = ./.;
>                 buildInputs = [
>                         haskellPackages.purescript
>                         nodePkgs.bower
>                         nodePkgs.grunt-cli
>                         git
>                 ];
>         };
> }
>
>
> --------- NODE_PATH -----------
>
> [nix-shell:~/dev/purescript-test]$ echo $NODE_PATH
>
> /nix/store/95k5x06vfspkfi2sw43nsjydffqsdahz-bin-bower-1.3.12/lib/node_modules:/nix/store/l56ffyyz233bi8njxp3cyn9qgpd1pwqj-nodejs-0.10.32/lib/node_modules:/nix/store/smrcylf038p9z8r3fs8rwarv9dg
> iahcy-bin-grunt-cli-0.1.13/lib/node_modules
>
>
> ------------- Error paste --------------
>
> [nix-shell:~/dev/purescript-test]$ bower
>
> module.js:340
>     throw err;
>           ^
> Error: Cannot find module 'es5-ext/object/assign'
>     at Function.Module._resolveFilename (module.js:338:15)
>     at Function.Module._load (module.js:280:25)
>     at Module.require (module.js:364:17)
>     at require (module.js:380:17)
>     at Object.<anonymous>
> (/nix/store/izf6avvrfmix793z3mwhwdb77bx3j8z7-node-d-0.1.1/lib/node_modules/d/index.js:3:21)
>     at Module._compile (module.js:456:26)
>     at Object.Module._extensions..js (module.js:474:10)
>     at Module.load (module.js:356:32)
>     at Function.Module._load (module.js:312:12)
>     at Module.require (module.js:364:17)
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.science.uu.nl/pipermail/nix-dev/attachments/20141125/e55f6c37/attachment.html 


More information about the nix-dev mailing list