Mac: npm install canvas error
1 2 3 4 5 6 7 | npm ERR! Package gobject-2.0 was not found in the pkg-config search path. npm ERR! Perhaps you should add the directory containing `gobject-2.0.pc' npm ERR! to the PKG_CONFIG_PATH environment variable npm ERR! Package 'gobject-2.0', required by 'pango', not found npm ERR! gyp: Call to 'pkg-config pangocairo --libs' returned exit status 1 while in binding.gyp. while trying to load binding.gyp npm ERR! gyp ERR! configure error npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1 |
Solution:
1 | brew install pkg-config cairo pango libpng jpeg giflib librsvg pixman |
1 | brew install glib |
1 2 | export npm_config_python=/path/to/python3.11 export PKG_CONFIG_PATH="/opt/homebrew/lib/pkgconfig:$PKG_CONFIG_PATH" |
Test wit 继续>