Open RashiqAzhan opened 4 months ago
I'm having trouble reproducing this exactly, but here are a few suggestions that I think will help:
It looks like the libuuid.so1 file is bundled with the dev
output of the libuuid package. You can add this output by running devbox add libuuid --outputs=out,dev
Devbox automatically symlinks any libraries, binaries, and files that it installs to $DEVBOX_PACKAGES_DIR
. If you need your node packages to access those libraries, you can try adding export LD_LIBRARY_PATH=$DEVBOX_PACKAGES_DIR/lib:$LD_LIBRARY_PATH
to your devbox.json's init_hook
. This will ensure that the libraries Devbox installs are in your LD_LIBRARY_PATH while still leaving the rest of LD_LIBRARY_PATH intact
Here is an example devbox.json that I got to work on https://devbox.sh:
https://github.com/Lagoja/node-canvas/blob/main/devbox.json
{
"$schema": "https://raw.githubusercontent.com/jetpack-io/devbox/0.10.1/.schema/devbox.schema.json",
"packages": {
"libuuid": {
"version": "latest",
"outputs": ["lib"]
},
"nodejs": "20.11",
"pkg-config": "latest",
"pixman": "latest",
"cairo": {
"version": "latest",
"outputs": ["dev"]
},
"freetype": {
"version": "latest"
},
"glib": {
"version": "latest",
"outputs": ["out"]
}
},
"env": {"LD_LIBRARY_PATH": "$DEVBOX_PACKAGES_DIR/lib"},
"shell": {
"init_hook": ["echo 'Welcome to devbox!' > /dev/null"],
"scripts": {
"test": ["echo \"Error: no test specified\" && exit 1"]
}
}
}
this solved my problem trying to load zlib when importing numpy.
might it make sense to add LD_LIBRARY_PATH by default if devbox.json doesn't specify one?
I tried it on macOS, but it's not working.
Package pangocairo was not found in the pkg-config search path.
Full stack trace:
../canvas@2.11.2/node_modules/canvas install$ node-pre-gyp install --fallback-to-build --update-binary
│ node-pre-gyp info it worked if it ends with ok
│ node-pre-gyp info using node-pre-gyp@1.0.11
│ node-pre-gyp info using node@18.18.2 | darwin | arm64
│ node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm…
│ node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas…
│ node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@18.18.2 (node-v108 ABI, unknown) (falling back to sou…
│ node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canv…
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.1
│ gyp info using node@18.18.2 | darwin | arm64
│ gyp info ok
│ gyp info it worked if it ends with ok
│ gyp info using node-gyp@9.4.1
│ gyp info using node@18.18.2 | darwin | arm64
│ gyp info find Python using Python version 3.11.6 found at "/nix/store/ai4hd8f1xhr0rfjdr17bxx1rwi42sx97-python3-3.11.6/bin/python3"
│ gyp info spawn /nix/store/ai4hd8f1xhr0rfjdr17bxx1rwi42sx97-python3-3.11.6/bin/python3
│ gyp info spawn args [
│ gyp info spawn args '/nix/store/2wwakb1xdpx14njxrp0s2fxq91q52k42-pnpm-8.10.2/lib/node_modules/pnpm/dist/node_modules/node-gyp/gyp/g…
│ gyp info spawn args 'binding.gyp',
│ gyp info spawn args '-f',
│ gyp info spawn args 'make',
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/0xthierry/Workspace/Meistrari/tela/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas/build/config.gy…
│ gyp info spawn args '-I',
│ gyp info spawn args '/nix/store/2wwakb1xdpx14njxrp0s2fxq91q52k42-pnpm-8.10.2/lib/node_modules/pnpm/dist/node_modules/node-gyp/addon…
│ gyp info spawn args '-I',
│ gyp info spawn args '/Users/0xthierry/Library/Caches/node-gyp/18.18.2/include/node/common.gypi',
│ gyp info spawn args '-Dlibrary=shared_library',
│ gyp info spawn args '-Dvisibility=default',
│ gyp info spawn args '-Dnode_root_dir=/Users/0xthierry/Library/Caches/node-gyp/18.18.2',
│ gyp info spawn args '-Dnode_gyp_dir=/nix/store/2wwakb1xdpx14njxrp0s2fxq91q52k42-pnpm-8.10.2/lib/node_modules/pnpm/dist/node_modules…
│ gyp info spawn args '-Dnode_lib_file=/Users/0xthierry/Library/Caches/node-gyp/18.18.2/<(target_arch)/node.lib',
│ gyp info spawn args '-Dmodule_root_dir=/Users/0xthierry/Workspace/Meistrari/tela/node_modules/.pnpm/canvas@2.11.2/node_modules/canv…
│ gyp info spawn args '-Dnode_engine=v8',
│ gyp info spawn args '--depth=.',
│ gyp info spawn args '--no-parallel',
│ gyp info spawn args '--generator-output',
│ gyp info spawn args 'build',
│ gyp info spawn args '-Goutput_dir=.'
│ gyp info spawn args ]
│ Package pangocairo was not found in the pkg-config search path.
│ Perhaps you should add the directory containing `pangocairo.pc'
│ to the PKG_CONFIG_PATH environment variable
│ No package 'pangocairo' found
│ gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
│ gyp ERR! configure error
│ gyp ERR! stack Error: `gyp` failed with exit code: 1
│ gyp ERR! stack at ChildProcess.onCpExit (/nix/store/2wwakb1xdpx14njxrp0s2fxq91q52k42-pnpm-8.10.2/lib/node_modules/pnpm/dist/node_…
│ gyp ERR! stack at ChildProcess.emit (node:events:517:28)
│ gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:292:12)
│ gyp ERR! System Darwin 23.5.0
│ gyp ERR! command "/nix/store/2gs1bzkbap7r4nr7vvyi575mdrj26nby-nodejs-18.18.2/bin/node" "/nix/store/2wwakb1xdpx14njxrp0s2fxq91q52k42-p…
│ gyp ERR! cwd /Users/0xthierry/Workspace/Meistrari/tela/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas
│ gyp ERR! node -v v18.18.2
│ gyp ERR! node-gyp -v v9.4.1
│ gyp ERR! not ok
│ node-pre-gyp ERR! build error
│ node-pre-gyp ERR! stack Error: Failed to execute '/nix/store/2gs1bzkbap7r4nr7vvyi575mdrj26nby-nodejs-18.18.2/bin/node /nix/store/2wwa…
│ node-pre-gyp ERR! stack at ChildProcess.<anonymous> (/Users/0xthierry/Workspace/Meistrari/tela/node_modules/.pnpm/@mapbox+node-pr…
│ node-pre-gyp ERR! stack at ChildProcess.emit (node:events:517:28)
│ node-pre-gyp ERR! stack at maybeClose (node:internal/child_process:1098:16)
│ node-pre-gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:303:5)
│ node-pre-gyp ERR! System Darwin 23.5.0
│ node-pre-gyp ERR! command "/nix/store/2gs1bzkbap7r4nr7vvyi575mdrj26nby-nodejs-18.18.2/bin/node" "/Users/0xthierry/Workspace/Meistrari…
│ node-pre-gyp ERR! cwd /Users/0xthierry/Workspace/Meistrari/tela/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas
│ node-pre-gyp ERR! node -v v18.18.2
│ node-pre-gyp ERR! node-pre-gyp -v v1.0.11
│ node-pre-gyp ERR! not ok
│ Failed to execute '/nix/store/2gs1bzkbap7r4nr7vvyi575mdrj26nby-nodejs-18.18.2/bin/node /nix/store/2wwakb1xdpx14njxrp0s2fxq91q52k42-pn…
└─ Failed in 1.2s at /Users/0xthierry/Workspace/Meistrari/tela/node_modules/.pnpm/canvas@2.11.2/node_modules/canvas
ELIFECYCLE Command failed with exit code 1.
Error: error running script "dev:setup-all" in Devbox: exit status 1
What happened?
node-canvas dependency breaks the entire node project.
node index.js
is broken.I tired following the solutions here to install libuuid manually but to no avail.
Terminal Output:
Expected output:
The project is working fine inside docker with which the portion shown under expected output was generated.
Steps to reproduce
node index.js
is broken.MWE: index.js
package.json
2.1. Devbox route to produce the error.
2.2. Docker route produces no errors.
Command
shell
devbox.json
Devbox version
0.10.5
Nix version
2.18.1
What system does this bug occur on?
Linux (x86-64)
Debug logs
No response