canvas@2.11.2 报错,提示

npm配置文件: metrics-registry = "https://registry.npmmirror.com/" canvas_binary_host_mirror = "https://registry.npmmirror.com/-/binary/canvas/" chromedriver_cdnurl = "https://r...

npm配置文件:

metrics-registry = "https://registry.npmmirror.com/"

canvas_binary_host_mirror = "https://registry.npmmirror.com/-/binary/canvas/"

chromedriver_cdnurl = "https://registry.npmmirror.com/-/binary/chromedriver/"

electron_builder_binaries_mirror = "https://registry.npmmirror.com/-/binary/electron-builder-binaries/"

electron_mirror = "https://registry.npmmirror.com/-/binary/electron/"

nodejs_org_mirror = "https://registry.npmmirror.com/-/binary/node/"

registry = "https://registry.npmmirror.com/"

sass_binary_site = "https://registry.npmmirror.com/-/binary/node-sass"


安装canvas@2.11.2时候 ,二进制安装不了,需要源码编译,node-pre-gyp install --fallback-to-build --update-binary【此参数是二进制安装不成功,转向源码编译了, windows 下除了python 环境还得需要visual studio环境】

编译源码需要python2.7的环境。源码编译的时候需要 @babel/core@7.4.0,原来package.json 里面配置的是 @babel/core@7.4.0的版本,需要升级

npm i @babel/core@7.4.0 --unsafe-perm

npm linux下默认www权限,所以root账号下编译时候需要创建的临时目录没有权限,所以后面要加上 --unsafe-perm 参数。

如果还是不行显示使用 npm install --build-from-source canvas  从源码编译



原先编译报错信息如下:

> canvas@2.11.2 install /data/project_deploy/zsztmonitor/zhitongweb/web/node_modules/canvas

> node-pre-gyp install --fallback-to-build --update-binary


node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@14.15.1 (node-v83 ABI, glibc) (falling back to source compile with node-gyp) 

node-pre-gyp WARN Hit error EACCES: permission denied, mkdir '/data/project_deploy/zsztmonitor/zhitongweb/web/node_modules/canvas/build' 

gyp WARN EACCES current user ("www") does not have permission to access the dev dir "/root/.cache/node-gyp/14.15.1"


  • 发表于 2024-10-11 12:16
  • 阅读 ( 26 )

你可能感兴趣的文章

相关问题

0 条评论

请先 登录 后评论
shitian
shitian

662 篇文章

作家榜 »

  1. shitian 662 文章
  2. 石天 437 文章
  3. 每天惠23 33 文章
  4. 小A 29 文章