!NhAsaYbbgmzHtXTPQJ:funklause.de

Nix NodeJS

209 Members
59 Servers

Load older messages


SenderMessageTime
22 Oct 2023
@daniel:nopemail.orgdaniel

Hi! I'm experiencing some node-gyp errors when building a package with buildNpmPackage.

Specifically, I get the error npm ERR! gyp: binding.gyp not found (cwd: /build/1501d1ijr2j8h40cgy6b8wwaz88hi53l-source/node_modules/@maplibre/maplibre-gl-native) while trying to load binding.gyp. Is anyone familiar with a way to migitate this, or is it possibly an upstream issue?

14:01:56
@c0ba1t:matrix.orgCobaltAnything node-gyp related tends to be a missing dependency. `maplibre-gl-native` sounds like something that needs OpenGL.14:04:42
@c0ba1t:matrix.orgCobaltHave you checked if the package requires another native library? This dependency may need to be added to `buildInputs` (or other inputs, depending on the usage)14:05:54
@daniel:nopemail.orgdanielI get it working in my dev shell when running npm run build. I see that the maplibre-gl-native package doesn't bundle binding.gyp like usual, and uses node-pre-gyp instead to fetch it from GitHub.14:05:59
@c0ba1t:matrix.orgCobaltAh, nix build/ nix-build iirc don't allow direct internet access for npm. 14:07:13
@c0ba1t:matrix.orgCobaltIn general it's not a good idea but you may be able to get around it by deactivating the sandbox for this specific build: `nix build --option sandbox=false ...` See also this related discussion: https://discourse.nixos.org/t/how-do-i-access-internet-inside-nix-build/7671/214:13:28
@c0ba1t:matrix.orgCobalt* In general it's not a good idea, but you may be able to get around it by deactivating the sandbox for this specific build: `nix build --option sandbox=false ...` See also this related discussion: https://discourse.nixos.org/t/how-do-i-access-internet-inside-nix-build/7671/214:14:14
@daniel:nopemail.orgdanielI believe npm runs in offline mode for the builder, so no luck, but thanks! 😥 14:19:11
@lily:lily.flowersLily FosterA node-gyp package doesn't provide a bindings.gyp and expects them to be downloaded from the internet...??!14:52:53
@lily:lily.flowersLily Fosternode-pre-gyp is for downloading prebuilt binaries14:54:07
@lily:lily.flowersLily Fosternot the files to build the binaries. afaik14:54:14
@lily:lily.flowersLily Fosterand is supposed to fail gracefully in the absence of a binary being available?14:54:24
@lily:lily.flowersLily FosterCan you share your full build log?14:54:35
@lily:lily.flowersLily Fosterthey removed the ability for it to build at all, so the fallback fails 🙃 https://github.com/mapbox/mapbox-gl-native/pull/1574814:55:29
@lily:lily.flowersLily Fosterwhy is node.js ecosystem such an ecological disaster14:55:39
@lily:lily.flowersLily Fosterthis pr would fix it; https://github.com/maplibre/maplibre-native/pull/53514:56:00
@lily:lily.flowersLily Foster * this pr would fix it: https://github.com/maplibre/maplibre-native/pull/53514:56:03
@lily:lily.flowersLily Fosteri'm not sure what a good option is to work around that for now though :(14:57:13
@lily:lily.flowersLily Fosterideally you can just patch the package.json in the dependency, but we don't have the machinery yet to patch npm dependencies like that...14:57:38
@lily:lily.flowersLily Foster(more details at https://github.com/maplibre/maplibre-native/issues/851 too)14:58:15
@lily:lily.flowersLily Fosterwhat you are trying to package that is using maplibre-native?14:58:33
@daniel:nopemail.orgdanielJust an application I'm building myself. I found the same references you linked, so I think I will have to discuss it with the maintainers15:00:39
@daniel:nopemail.orgdanielSeems awful to patch by hand15:00:51
@lily:lily.flowersLily Fosteri'm really not sure how you would patch by hand tbh :(15:02:08
@lily:lily.flowersLily Fosterunless you forked it i guess15:02:15
@daniel:nopemail.orgdanielYeah 😅 Thanks, though!15:03:45
@lily:lily.flowersLily Fosterif you have any ideas though, let me know. or let me know if you figure out something, i am curious if you come up with a workaround!15:07:22
@lily:lily.flowersLily Fosteri'm thinking once we have redone lockfile fixup, we could maybe also work on adding an arg for passing dep patches that get picked up and applied in the fetcher15:09:13
@lily:lily.flowersLily Fosterwhich would help with situations like this15:09:25
@lily:lily.flowersLily Foster You know. Actually. Since we do npm ci --ignore-scripts iirc, we could probably add a hook between that and the npm rebuild to allow patching deps before running install scripts too 15:10:03

Show newer messages


Back to Room ListRoom Version: 6