Pit of canvas.js and node-canvas

1. After half a day after the dependency download, the installation was not completed, and an error was reported at the end.

\node_modules\canvas: Command failed. Exit code: 1 Command: node-pre-gyp install --fallback-to-build Arguments:

Workaround: Official:  Installation: Windows Automattic/node-canvas Wiki GitHub

1. First install a dependency globally:

npm i node-gyp

2. Download GTK 2

Download link - win64

3. Then unzip to the folder GTK on the C drive

 

4. Then re-download the canvas dependencies 

2. Some image encoding formats do not support

The picture found on the Internet is the same png, but an error will be reported due to the lack of encoding method or image encoding information. The current solution is to use the image reconstruction plug-in to reconstruct it.

Guess you like

Origin blog.csdn.net/A88552211/article/details/131581439