Skip to content

Contributing guide: nix-shell doesn't install all tools #4854

Closed
@mtojek

Description

@mtojek

OS: Monterey 12.3

I was following the CONTRIBUTING guide and decided to use nix-shell. Unfortunately, the method wasn't perfect as I spent some time on solving pkg-config related issues:

Show console dump
error /Users/mtojek/code/coder/site/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments:
Directory: /Users/mtojek/code/coder/site/node_modules/canvas
Output:
node-pre-gyp info it worked if it ends with ok
node-pre-gyp info using node-pre-gyp@1.0.10
node-pre-gyp info using node@16.16.0 | darwin | arm64
node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.10.0/canvas-v2.10.0-node-v93-darwin-unknown-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.0/canvas-v2.10.0-node-v93-darwin-unknown-arm64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.10.0 and node@16.16.0 (node-v93 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.10.0/canvas-v2.10.0-node-v93-darwin-unknown-arm64.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@16.16.0 | darwin | arm64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@9.0.0
gyp info using node@16.16.0 | darwin | arm64
gyp info find Python using Python version 3.8.9 found at "/Library/Developer/CommandLineTools/usr/bin/python3"
gyp http GET https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v16.16.0/node-v16.16.0-headers.tar.gz
gyp http GET https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v16.16.0/SHASUMS256.txt
gyp info spawn /Library/Developer/CommandLineTools/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
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/mtojek/code/coder/site/node_modules/canvas/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/mtojek/Library/Caches/node-gyp/16.16.0/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/mtojek/Library/Caches/node-gyp/16.16.0',
gyp info spawn args   '-Dnode_gyp_dir=/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/mtojek/Library/Caches/node-gyp/16.16.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/mtojek/code/coder/site/node_modules/canvas',
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 ]
/bin/sh: pkg-config: command not found
gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 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/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:261:16)
gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
gyp ERR! System Darwin 21.4.0
gyp ERR! command "/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/bin/node" "/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=/Users/mtojek/code/coder/site/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/Users/mtojek/code/coder/site/node_modules/canvas/build/Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v93"
gyp ERR! cwd /Users/mtojek/code/coder/site/node_modules/canvas
gyp ERR! node -v v16.16.0
gyp ERR! node-gyp -v v9.0.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/bin/node /nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/mtojek/code/coder/site/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/mtojek/code/coder/site/node_modules/canvas/build/Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/Users/mtojek/code/coder/site/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1092:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
node-pre-gyp ERR! System Darwin 21.4.0
node-pre-gyp ERR! command "/nix/store/c0hvn0hnxppdrvk3iamz3cfk50jhvl8y-nodejs-16.16.0/bin/node" "/Users/mtojek/code/coder/site/node_modules/canvas/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
node-pre-gyp ERR! cwd /Users/mtojek/code/coder/site/node_modules/canvas
node-pre-gyp ERR! node -v v16.16.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.10
node-pre-gyp ERR! not ok

I encountered a few similar issues which I solved with:

brew install pkgconfig
brew install pango
brew install cairo
brew install pandocomatic
brew install pangocairo

According to the CONTRIBUTING page, these tools should be installed while bootstrapping the dev environment with nix-shell? Manual steps are advised only in case a user doesn't want to install the nix-shell.

Metadata

Metadata

Assignees

Labels

s3Bugs that confuse, annoy, or are purely cosmetic

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions