[Question] <node-pre-gyp error when run `yarn install` in web-app, mac m2 env>
- Dominant language
- Java
- Stars
- 7.4k
- Forks
- 1.3k
- Avg merge
- 1d 20h
- Merged PRs (30d)
- 32
Description
### Question
node-pre-gyp error when run `yarn install` in web-app. mac m2 env.
```
yarn install v1.22.17
[1/4] 🔍 Resolving packages...
warning protractor@7.0.0: We have news to share - Protractor is deprecated and will reach end-of-life by Summer 2023. To learn more and find out about other options please refer to this post on the Angular blog. Thank you for using and contributing to Protractor. https://goo.gle/state-of-e2e-in-angular
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
warning "ng-alain > ng-alain-plugin-theme@15.0.1" has unmet peer dependency "jsonc-parser@^3.0.0".
warning "ng-alain > ng-alain-plugin-theme@15.0.1" has unmet peer dependency "less@^4.1.3".
[4/4] 🔨 Building fresh packages...
[-/4] ⢀ waiting...
[2/4] ⢀ canvas
[-/4] ⢀ waiting...
warning Error running install script for optional dependency: "/Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas: Command failed.
Exit code: 1
Command: node-pre-gyp install --fallback-to-build --update-binary
Arguments:
Directory: /Users/tom/code/opensource/hertzbeat/web-app/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.11
node-pre-gyp info using node@18.18.0 | 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-arm64.tar.gz
node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@18.18.0 (node-v108 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.11.2/canvas-v2.11.2-node-v108-darwin-unknown-arm64.tar.gz
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@18.18.0 | darwin | arm64
gyp info ok
gyp info it worked if it ends with ok
gyp info using node-gyp@9.4.0
gyp info using node@18.18.0 | darwin | arm64
gyp info find Python using Python version 3.9.13 found at \"/opt/homebrew/opt/python@3.9/bin/python3.9\"
gyp info spawn /opt/homebrew/opt/python@3.9/bin/python3.9
gyp info spawn args [
gyp info spawn args '/Users/tom/code/opensource/hertzbeat/web-app/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/tom/code/opensource/hertzbeat/web-app/node_modules/canvas/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/tom/code/opensource/hertzbeat/web-app/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/tom/Library/Caches/node-gyp/18.18.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/tom/Library/Caches/node-gyp/18.18.0',
gyp info spawn args '-Dnode_gyp_dir=/Users/tom/code/opensource/hertzbeat/web-app/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/tom/Library/Caches/node-gyp/18.18.0/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/tom/code/opensource/hertzbeat/web-app/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 ]
Package pixman-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `pixman-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'pixman-1' found
gyp: Call to 'pkg-config pixman-1 --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 (/Users/tom/code/opensource/hertzbeat/web-app/node_modules/node-gyp/lib/configure.js:325:16)
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 22.1.0
gyp ERR! command \"/Users/tom/.nvm/versions/node/v18.18.0/bin/node\" \"/Users/tom/code/opensource/hertzbeat/web-app/node_modules/node-gyp/bin/node-gyp.js\" \"configure\" \"--fallback-to-build\" \"--update-binary\" \"--module=/Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas/build/Release/canvas.node\" \"--module_name=canvas\" \"--module_path=/Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas/build/Release\" \"--napi_version=9\" \"--node_abi_napi=napi\" \"--napi_build_version=0\" \"--node_napi_label=node-v108\"
gyp ERR! cwd /Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas
gyp ERR! node -v v18.18.0
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute '/Users/tom/.nvm/versions/node/v18.18.0/bin/node /Users/tom/code/opensource/hertzbeat/web-app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --update-binary --module=/Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v108' (1)
node-pre-gyp ERR! stack at ChildProcess. (/Users/tom/code/opensource/hertzbeat/web-app/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
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 22.1.0
node-pre-gyp ERR! command \"/Users/tom/.nvm/versions/node/v18.18.0/bin/node\" \"/Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas/node_modules/.bin/node-pre-gyp\" \"install\" \"--fallback-to-build\" \"--update-binary\"
node-pre-gyp ERR! cwd /Users/tom/code/opensource/hertzbeat/web-app/node_modules/canvas
node-pre-gyp ERR! node -v v18.18.0
node-pre-gyp ERR! node-pre-gyp -v v1.0.11
node-pre-gyp ERR! not ok
Failed to execute '/Users/tom/.nvm/versions/node/v18.18.0/bin/node /Users/tom/code/opensource/hertzbeat/web-app/node_modules/node-gyp/bin/node-gyp.js configure --fallback-to-build --
```
Contributor guide
Research direction
Start in the web-app dependency configuration and reproduce yarn install with Node 18 on macOS arm64. Investigate the canvas/node-pre-gyp fallback and the missing pixman-1 dependency; done means the web-app dependencies install successfully in the reported environment or the supported setup is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, node.js, python
- Domain
- build-system, developer-experience, web-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100