'pkg-config not found issue on macOS M1


I think I have tried most of the solutions/suggestions on internet for this issue.
I'm using macOS Monterey / M1 Max / node version 10., and facing this error saying :

/bin/sh: 1: pkg-config: not found gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp

Error: gyp failed with exit code: 1

I have tried installing pkg-config with brew, but having the same error.
Does anyone have idea about this issue? I also have rosetta installed.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source