Because this encoder needs image, there is no problem if it is the front-end, that is, the browser, because cavans is not required. If it is installed on the server, because the image needs canvas drawing to render, it needs to be installed on the server. If it is Windows, an error will be reported: There is no C: / GTK.

The original documentation did not indicate the need to manually install GTK, as shown

Then NPM install Canvas

NPM install EsC-pos-encoder later

Github.com/NielsLeenhe…

It should also be noted that since pthyon is required to compile native C++, environment variables still need to be set — see juejin.cn/post/684490…