当前位置:网站首页>安装canvas遇到的问题和运行项目遇到的报错
安装canvas遇到的问题和运行项目遇到的报错
2022-06-12 12:05:00 【程序务虚论】
1.mac安装问题
1)第一步使用brew安装:brew install pkg-config cairo pango libpng jpeg giflib librsvg
如果上面命令安装出错,可以分开安装(推荐)
brew install pkg-config
brew install cairo
brew install pango
brew install libpng
brew install jpeg
brew install giflib
brew install librsvg
具体也可以参考官网文档:
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/
https://github.com/Automattic/node-canvas/wiki/ 安装完之后,可以使用命令:brew list 查看是否都已安装上
2)第二步安装canvas
npm instal canvas
安装完之后,使用命令:npm list 查看是否已安装上canvas
2.运行项目报错一:
Error: Cannot find module '/Users/ymxx/xx/xx/xx/node_modules/canvas'
解决方案:
将安装好的canvas(位置:usr/local/lib/node_modules/node-canvas)复制到项目下面-node_modules下面,并改名为canvas(名字与项目中一致)
3.运行项目报错二:
Error: Cannot find module '../build/Release/canvas.node'
解决方案:
在当前项目中打开终端
先执行:npm uninstall canvas
再安装:npm i canvas
安装完之后使用命令:npm list 查看是否在本项目中已安装成功
最后重新初始化:yarn install
启动项目成功!
边栏推荐
猜你喜欢

First understand the onion model, analyze the implementation process of middleware, and analyze the source code of KOA Middleware

LeetCode 1037. Effective boomerang (vector cross product)

Inter class and intra class relations in video classification -- regularization

5G NR協議學習--TS38.211下行通道

ARM processor mode and register

IP地址管理

Video JS library uses custom components

Create servlet project

TinyMCE series (II) TinyMCE plug-in development

IP address management
随机推荐
promise的理解已经利用promise实现图片的预加载(顺序加载)
Node crawler puppeter usage
Visio 2019 uses PJ
Rich text editor copying pictures in word documents
Reasons for SSL introduction and encryption steps
如何确定首页和搜索之间的关系呢?首页与搜索的关系
Pytorch笔记
Design of virtual scrolling list
Neighbor item status update of neighbor subsystem
for in 与Object.keys()的区别
無重複字符的最長字符串(LeetCode 3)
淘宝新改版商家如何操作,需要注意的点有哪些
创建Servlet项目
5g NR Protocol Learning - - ts38.211 downlink channel
JS to load and display Excel files
UML series articles (31) architecture modeling - deployment diagram
Analyze the implementation principle of the onion model, and connect the onion model in your own project
ARP protocol data processing process of neighbor subsystem
LeetCode 497. Random points in non overlapping rectangles (prefix and + bisection)
B. Wall painting (C language)