makes icon indicating copy to clipboard operation
makes copied to clipboard

makeNodeJs problem with a dependency

Open ludsrill opened this issue 4 years ago • 13 comments

Looks like makeNodeJs is trying to find a file that doesn't exists when trying to get this npm package

https://www.npmjs.com/package/gherkin-lint

This is the error that I got

/nix/store/z710wsxj70dx1dyjpi4jl961bk3dk79c-make-derivation: line 10:     7 Terminated              python -m http.server --bind "${registry_address}" --directory "${envRegistry}" "${registry_port}"
[INFO] Generating binaries from /nix/store/fb4mmvn1gvmnj1v52q7dyrrjkb9fhmvc-make-node-js-modules-for-gherkin-linter/gherkin-lint/package.json
[INFO] Generating binaries from /nix/store/fb4mmvn1gvmnj1v52q7dyrrjkb9fhmvc-make-node-js-modules-for-gherkin-linter/gherkin/dist/package.json
chmod: cannot access '/nix/store/fb4mmvn1gvmnj1v52q7dyrrjkb9fhmvc-make-node-js-modules-for-gherkin-linter/gherkin/dist/bin/gherkin': No such file or directory
builder for '/nix/store/vgw0vv8873zkf1fax4r93nzhl0dh4jfd-make-node-js-modules-for-gherkin-linter.drv' failed with exit code 1
cannot build derivation '/nix/store/znch67rqsbjy6i1yhw630vjygha0sxm6-make-template-for-make-search-paths.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1r12abry7g78v85x1lxd4sbnaaysn56x-make-template-for-make-search-paths.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/1wz745ljak12irndrhar4bfrdndfdc08-make-template-for-make-script-for-build-solution-gherkin.drv': 1 dependencies couldn't be built
cannot build derivation '/nix/store/vfkk4y25v97zzwdj12dzapl14lfbayl1-build-solution-gherkin.drv': 1 dependencies couldn't be built
error: build of '/nix/store/vfkk4y25v97zzwdj12dzapl14lfbayl1-build-solution-gherkin.drv' failed

ludsrill avatar Dec 06 '21 16:12 ludsrill

That's odd! Can you please provide the nix source code?

dsalaza4 avatar Dec 06 '21 18:12 dsalaza4

{ makeDerivation
, makeDerivationParallel
, projectPath
, inputs
, makeScript
, projectPathsMatching
, makeNodeJsModules
, makeNodeJsEnvironment
, ...
}:
let
  gherkinlint = makeNodeJsEnvironment {
    name = "gherkin-linter";
    nodeJsVersion = "14";
    packageJson =
      projectPath "/makes/solutions/gherkin/package.json";
    packageLockJson =
      projectPath "/makes/solutions/gherkin/package-lock.json";
  };
in
makeScript {
  name = "build-solution-gherkin";
  searchPaths = {
    bin = [
      inputs.nixpkgs.cucumber
    ];
    source = [
      gherkinlint
    ];
  };
  entrypoint = ./builder.sh;
}

That's the last script that I tried

ludsrill avatar Dec 06 '21 19:12 ludsrill

What about package.json and package-lock.json?

dsalaza4 avatar Dec 06 '21 19:12 dsalaza4

{
  "name": "gherkin-linter",
  "version": "1.0.0",
  "lockfileVersion": 1,
  "requires": true,
  "dependencies": {
    "@protobufjs/aspromise": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/@protobufjs/aspromise/-/aspromise-1.1.2.tgz",
      "integrity": "sha1-m4sMxmPWaafY9vXQiToU00jzD78="
    },
    "@protobufjs/base64": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/@protobufjs/base64/-/base64-1.1.2.tgz",
      "integrity": "sha512-AZkcAA5vnN/v4PDqKyMR5lx7hZttPDgClv83E//FMNhR2TMcLUhfRUBHCmSl0oi9zMgDDqRUJkSxO3wm85+XLg=="
    },
    "@protobufjs/codegen": {
      "version": "2.0.4",
      "resolved": "https://registry.npmjs.org/@protobufjs/codegen/-/codegen-2.0.4.tgz",
      "integrity": "sha512-YyFaikqM5sH0ziFZCN3xDC7zeGaB/d0IUb9CATugHWbd1FRFwWwt4ld4OYMPWu5a3Xe01mGAULCdqhMlPl29Jg=="
    },
    "@protobufjs/eventemitter": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@protobufjs/eventemitter/-/eventemitter-1.1.0.tgz",
      "integrity": "sha1-NVy8mLr61ZePntCV85diHx0Ga3A="
    },
    "@protobufjs/fetch": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@protobufjs/fetch/-/fetch-1.1.0.tgz",
      "integrity": "sha1-upn7WYYUr2VwDBYZ/wbUVLDYTEU=",
      "requires": {
        "@protobufjs/aspromise": "^1.1.1",
        "@protobufjs/inquire": "^1.1.0"
      }
    },
    "@protobufjs/float": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/@protobufjs/float/-/float-1.0.2.tgz",
      "integrity": "sha1-Xp4avctz/Ap8uLKR33jIy9l7h9E="
    },
    "@protobufjs/inquire": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@protobufjs/inquire/-/inquire-1.1.0.tgz",
      "integrity": "sha1-/yAOPnzyQp4tyvwRQIKOjMY48Ik="
    },
    "@protobufjs/path": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/@protobufjs/path/-/path-1.1.2.tgz",
      "integrity": "sha1-bMKyDFya1q0NzP0hynZz2Nf79o0="
    },
    "@protobufjs/pool": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@protobufjs/pool/-/pool-1.1.0.tgz",
      "integrity": "sha1-Cf0V8tbTq/qbZbw2ZQbWrXhG/1Q="
    },
    "@protobufjs/utf8": {
      "version": "1.1.0",
      "resolved": "https://registry.npmjs.org/@protobufjs/utf8/-/utf8-1.1.0.tgz",
      "integrity": "sha1-p3c2C1s5oaLlEG+OhY8v0tBgxXA="
    },
    "@types/long": {
      "version": "4.0.1",
      "resolved": "https://registry.npmjs.org/@types/long/-/long-4.0.1.tgz",
      "integrity": "sha512-5tXH6Bx/kNGd3MgffdmP4dy2Z+G4eaXw0SE81Tq3BNadtnMR5/ySMzX4SLEzHJzSmPNn4HIdpQsBvXMUykr58w=="
    },
    "@types/node": {
      "version": "16.11.11",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.11.tgz",
      "integrity": "sha512-KB0sixD67CeecHC33MYn+eYARkqTheIRNuu97y2XMjR7Wu3XibO1vaY6VBV6O/a89SPI81cEUIYT87UqUWlZNw=="
    },
    "@types/uuid": {
      "version": "3.4.10",
      "resolved": "https://registry.npmjs.org/@types/uuid/-/uuid-3.4.10.tgz",
      "integrity": "sha512-BgeaZuElf7DEYZhWYDTc/XcLZXdVgFkVSTa13BqKvbnmUrxr3TJFKofUxCtDO9UQOdhnV+HPOESdHiHKZOJV1A=="
    },
    "balanced-match": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz",
      "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw=="
    },
    "brace-expansion": {
      "version": "1.1.11",
      "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz",
      "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==",
      "requires": {
        "balanced-match": "^1.0.0",
        "concat-map": "0.0.1"
      }
    },
    "buffer-from": {
      "version": "1.1.2",
      "resolved": "https://registry.npmjs.org/buffer-from/-/buffer-from-1.1.2.tgz",
      "integrity": "sha512-E+XQCRwSbaaiChtv6k6Dwgc+bx+Bs6vuKJHHl5kox/BaKbhiXzqQOwK4cO22yElGp2OCmjwVhT3HmxgyPGnJfQ=="
    },
    "commander": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/commander/-/commander-5.0.0.tgz",
      "integrity": "sha512-JrDGPAKjMGSP1G0DUoaceEJ3DZgAfr/q6X7FVk4+U5KxUSKviYGM2k6zWkfyyBHy5rAtzgYJFa1ro2O9PtoxwQ=="
    },
    "concat-map": {
      "version": "0.0.1",
      "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz",
      "integrity": "sha1-2Klr13/Wjfd5OnMDajug1UBdR3s="
    },
    "core-js": {
      "version": "3.6.4",
      "resolved": "https://registry.npmjs.org/core-js/-/core-js-3.6.4.tgz",
      "integrity": "sha512-4paDGScNgZP2IXXilaffL9X7968RuvwlkK3xWtZRVqgd8SYNiVKRJvkFd1aqqEuPfN7E68ZHEp9hDj6lHj4Hyw=="
    },
    "cucumber-messages": {
      "version": "8.0.0",
      "resolved": "https://registry.npmjs.org/cucumber-messages/-/cucumber-messages-8.0.0.tgz",
      "integrity": "sha512-lUnWRMjwA9+KhDec/5xRZV3Du67ISumHnVLywWQXyvzmc4P+Eqx8CoeQrBQoau3Pw1hs4kJLTDyV85hFBF00SQ==",
      "requires": {
        "@types/uuid": "^3.4.6",
        "protobufjs": "^6.8.8",
        "uuid": "^3.3.3"
      }
    },
    "fs.realpath": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz",
      "integrity": "sha1-FQStJSMVjKpA20onh8sBQRmU6k8="
    },
    "gherkin": {
      "version": "9.0.0",
      "resolved": "https://registry.npmjs.org/gherkin/-/gherkin-9.0.0.tgz",
      "integrity": "sha512-6xoAepoxo5vhkBXjB4RCfVnSKHu5z9SqXIQVUyj+Jw8BQX8odATlee5otXgdN8llZvyvHokuvNiBeB3naEnnIQ==",
      "requires": {
        "commander": "^4.0.1",
        "cucumber-messages": "8.0.0",
        "source-map-support": "^0.5.16"
      },
      "dependencies": {
        "commander": {
          "version": "4.1.1",
          "resolved": "https://registry.npmjs.org/commander/-/commander-4.1.1.tgz",
          "integrity": "sha512-NOKm8xhkzAjzFx8B2v5OAHT+u5pRQc2UCa2Vq9jYL/31o2wi9mxBA7LIFs3sV5VSC49z6pEhfbMULvShKj26WA=="
        }
      }
    },
    "gherkin-lint": {
      "version": "4.2.2",
      "resolved": "https://registry.npmjs.org/gherkin-lint/-/gherkin-lint-4.2.2.tgz",
      "integrity": "sha512-+vu0wbrwxaaEdrheU9pH2MYR6zk38u2IkrCIg6IETUw1lkrNVAfIfOCihwrrL2NTJv5Iia/C7hZEBNwjGSkL2Q==",
      "requires": {
        "commander": "5.0.0",
        "core-js": "3.6.4",
        "gherkin": "9.0.0",
        "glob": "7.1.6",
        "lodash": "4.17.21",
        "strip-json-comments": "3.0.1",
        "xml-js": "^1.6.11"
      }
    },
    "glob": {
      "version": "7.1.6",
      "resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
      "integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
      "requires": {
        "fs.realpath": "^1.0.0",
        "inflight": "^1.0.4",
        "inherits": "2",
        "minimatch": "^3.0.4",
        "once": "^1.3.0",
        "path-is-absolute": "^1.0.0"
      }
    },
    "inflight": {
      "version": "1.0.6",
      "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz",
      "integrity": "sha1-Sb1jMdfQLQwJvJEKEHW6gWW1bfk=",
      "requires": {
        "once": "^1.3.0",
        "wrappy": "1"
      }
    },
    "inherits": {
      "version": "2.0.4",
      "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
      "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
    },
    "lodash": {
      "version": "4.17.21",
      "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.21.tgz",
      "integrity": "sha512-v2kDEe57lecTulaDIuNTPy3Ry4gLGJ6Z1O3vE1krgXZNrsQ+LFTGHVxVjcXPs17LhbZVGedAJv8XZ1tvj5FvSg=="
    },
    "long": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/long/-/long-4.0.0.tgz",
      "integrity": "sha512-XsP+KhQif4bjX1kbuSiySJFNAehNxgLb6hPRGJ9QsUr8ajHkuXGdrHmFUTUUXhDwVX2R5bY4JNZEwbUiMhV+MA=="
    },
    "minimatch": {
      "version": "3.0.4",
      "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
      "integrity": "sha512-yJHVQEhyqPLUTgt9B83PXu6W3rx4MvvHvSUvToogpwoGDOUQ+yDrR0HRot+yOCdCO7u4hX3pWft6kWBBcqh0UA==",
      "requires": {
        "brace-expansion": "^1.1.7"
      }
    },
    "once": {
      "version": "1.4.0",
      "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz",
      "integrity": "sha1-WDsap3WWHUsROsF9nFC6753Xa9E=",
      "requires": {
        "wrappy": "1"
      }
    },
    "path-is-absolute": {
      "version": "1.0.1",
      "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz",
      "integrity": "sha1-F0uSaHNVNP+8es5r9TpanhtcX18="
    },
    "protobufjs": {
      "version": "6.11.2",
      "resolved": "https://registry.npmjs.org/protobufjs/-/protobufjs-6.11.2.tgz",
      "integrity": "sha512-4BQJoPooKJl2G9j3XftkIXjoC9C0Av2NOrWmbLWT1vH32GcSUHjM0Arra6UfTsVyfMAuFzaLucXn1sadxJydAw==",
      "requires": {
        "@protobufjs/aspromise": "^1.1.2",
        "@protobufjs/base64": "^1.1.2",
        "@protobufjs/codegen": "^2.0.4",
        "@protobufjs/eventemitter": "^1.1.0",
        "@protobufjs/fetch": "^1.1.0",
        "@protobufjs/float": "^1.0.2",
        "@protobufjs/inquire": "^1.1.0",
        "@protobufjs/path": "^1.1.2",
        "@protobufjs/pool": "^1.1.0",
        "@protobufjs/utf8": "^1.1.0",
        "@types/long": "^4.0.1",
        "@types/node": ">=13.7.0",
        "long": "^4.0.0"
      }
    },
    "sax": {
      "version": "1.2.4",
      "resolved": "https://registry.npmjs.org/sax/-/sax-1.2.4.tgz",
      "integrity": "sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw=="
    },
    "source-map": {
      "version": "0.6.1",
      "resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
      "integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g=="
    },
    "source-map-support": {
      "version": "0.5.21",
      "resolved": "https://registry.npmjs.org/source-map-support/-/source-map-support-0.5.21.tgz",
      "integrity": "sha512-uBHU3L3czsIyYXKX88fdrGovxdSCoTGDRZ6SYXtSRxLZUzHg5P/66Ht6uoUlHu9EZod+inXhKo3qQgwXUT/y1w==",
      "requires": {
        "buffer-from": "^1.0.0",
        "source-map": "^0.6.0"
      }
    },
    "strip-json-comments": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/strip-json-comments/-/strip-json-comments-3.0.1.tgz",
      "integrity": "sha512-VTyMAUfdm047mwKl+u79WIdrZxtFtn+nBxHeb844XBQ9uMNTuTHdx2hc5RiAJYqwTj3wc/xe5HLSdJSkJ+WfZw=="
    },
    "uuid": {
      "version": "3.4.0",
      "resolved": "https://registry.npmjs.org/uuid/-/uuid-3.4.0.tgz",
      "integrity": "sha512-HjSDRw6gZE5JMggctHBcjVak08+KEVhSIiDzFnT9S9aegmp85S/bReBVTb4QTFaRNptJ9kuYaNhnbNEOkbKb/A=="
    },
    "wrappy": {
      "version": "1.0.2",
      "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz",
      "integrity": "sha1-tSQ9jz7BqjXxNkYFvA0QNuMKtp8="
    },
    "xml-js": {
      "version": "1.6.11",
      "resolved": "https://registry.npmjs.org/xml-js/-/xml-js-1.6.11.tgz",
      "integrity": "sha512-7rVi2KMfwfWFl+GpPg6m80IVMWXLRjO+PxTq7V2CDhoGak0wzYzFgUY2m4XJ47OGdXd8eLE8EmwfAmdjw7lC1g==",
      "requires": {
        "sax": "^1.2.4"
      }
    }
  }
}

{
  "name": "gherkin-linter",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "gherkin-lint": "^4.2.2"
  }
}

ludsrill avatar Dec 06 '21 19:12 ludsrill

Maybe this is an error with your bash script since it could be looking for a non-existing path somewhere outside the main.nix can you show us the script?

jpverde avatar Dec 06 '21 21:12 jpverde

I thought the same so I simplified the code as much as possible, but it had nothing to do

function main {
  local HOME="."

  info Compiling Gherkin solution
}

main "${@}"

ludsrill avatar Dec 06 '21 21:12 ludsrill

After investigating the resulting node_modules directory, it looks like the problem comes from the fact that node_modules/gherkin/dist/package.json has the following binary declared:

"bin": {
    "gherkin-javascript": "bin/gherkin"
},

Such path (node_modules/gherkin/dist/bin/gherkin) does not exist.

I am not 100% sure but this does not look like a normal behavior, as this has never happened before and other package.json files within the same node_modules point correctly to existing files.

@ludsrill Maybe this can be reported as an issue here?

dsalaza4 avatar Dec 07 '21 17:12 dsalaza4

For now I think you can experiment with other versions or simply do a npm install using nixpkgs.nodejs every time the job runs.

dsalaza4 avatar Dec 07 '21 17:12 dsalaza4

So it's confirmed that this is an external issue?

jpverde avatar Dec 10 '21 14:12 jpverde

I cannot be sure but it seems that way, I put it aside for the moment if I find a solution along the way I'll let you know

ludsrill avatar Dec 10 '21 14:12 ludsrill

I think we just found another case of this. Maybe we'll have to avoid failure when a symbolic link cannot be created :thinking:

dsalaza4 avatar Jan 26 '22 17:01 dsalaza4

@ludsrill Is this problem still present after the nixpkgs update?

jpverde avatar Mar 18 '22 17:03 jpverde

It most likely will be, the problem is related to broken binaries in the npm library.

dsalaza4 avatar Mar 30 '22 17:03 dsalaza4