当前位置:网站首页>Problems encountered in installing canvas and errors encountered in running the project

Problems encountered in installing canvas and errors encountered in running the project

2022-06-12 12:10:00 On procedural retreat

1.mac Installation problems

1) The first step is to use brew install :brew install pkg-config cairo pango libpng jpeg giflib librsvg

         If the above command is installed incorrectly , It can be installed separately ( recommend )

        brew install pkg-config

        brew install cairo

        brew install pango

        brew install libpng

        brew install jpeg

        brew install giflib

        brew install librsvg

         For details, please refer to the official website :

GitHub - Automattic/node-canvas: Node canvas is a Cairo backed Canvas implementation for NodeJS.Node canvas is a Cairo backed Canvas implementation for NodeJS. - GitHub - Automattic/node-canvas: Node canvas is a Cairo backed Canvas implementation for NodeJS.https://github.com/Automattic/node-canvashttps://github.com/Automattic/node-canvas/wiki/icon-default.png?t=M4ADhttps://github.com/Automattic/node-canvas/wiki/         After installation , You can use commands :brew list Check to see if they are all installed

2) The second step is to install canvas

        npm instal canvas

         After installation , Use command :npm list Check to see if... Is installed canvas

2. An error is reported in the operation item :

Error: Cannot find module '/Users/ymxx/xx/xx/xx/node_modules/canvas'
Solution :

Will be installed canvas( Location :usr/local/lib/node_modules/node-canvas) Copy to the project -node_modules below , And changed his name to canvas( The name is the same as in the project )

3. Operation item error report II :

Error: Cannot find module '../build/Release/canvas.node'

Solution :

Open the terminal in the current project

Execute first :npm uninstall canvas

Install again :npm i canvas

After installation, use the command :npm list Check whether it has been successfully installed in this project

Finally, reinitialize :yarn install

Project started successfully !

原网站

版权声明
本文为[On procedural retreat]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/163/202206121204475029.html