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

win7安装node-canvas出现错误:

module.js:328
    throw err;
    ^


Error: Cannot find module '../build/Release/canvas'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (D:\wwwroot\mobile\trunk\src\node_modules\canvas\lib\b
indings.js:3:18)
    at Module._compile (module.js:398:26)
    at Module._extensions..js (module.js:405:10)
    at Object.require.extensions.(anonymous function) [as .js] (D:\wwwroot\mobil
e\trunk\src\node_modules\babel-register\lib\node.js:152:7)
    at Module.load (module.js:344:32)
    at Function.Module._load (module.js:301:12)
    at Module.require (module.js:354:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (D:\wwwroot\mobile\trunk\src\node_modules\canvas\lib\c
anvas.js:13:14)
    at Module._compile (module.js:398:26)
    at Module._extensions..js (module.js:405:10)
    at Object.require.extensions.(anonymous function) [as .js] (D:\wwwroot\mobil
e\trunk\src\node_modules\babel-register\lib\node.js:152:7)

解决办法:

npm rebuild canvas

node-gyp rebuild err :

在此解决方案中一次生成一个项目。若要启用并行生成,请添加“/m”开关。
  Canvas.cc
  CanvasGradient.cc
  CanvasPattern.cc
  CanvasRenderingContext2d.cc
..\src\Canvas.cc(145): warning C4457: declaration of 'data' hides function para
meter [\node_modules\canvas\build\canvas.vcxproj]
  ..\src\Canvas.cc(141): note: see declaration of 'data'
  color.cc
  Image.cc
  ImageData.cc
  init.cc
  win_delay_load_hook.c
C:\Users\sf\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\sr
c\win_delay_load_hook.c(28): warning C4055: 'type cast': from data pointer 'HMO
DULE' to function pointer 'FARPROC' [D:\wwwroot\mobile\trunk\src\node_modules\c
anvas\build\canvas.vcxproj]
C:\Users\sf\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\sr
c\win_delay_load_hook.c(31): error C2373: '__pfnDliNotifyHook2': redefinition;
different type modifiers [D:\wwwroot\mobile\trunk\src\node_modules\canvas\build
\canvas.vcxproj]
  D:\Program Files\Microsoft Visual Studio 2015\VC\include\delayimp.h(134): not
  e: see declaration of '__pfnDliNotifyHook2'

解决办法:

注释 "C:\Users\sf\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\sr
c\win_delay_load_hook.c" 中的 PfnDliHook __pfnDliNotifyHook2 = load_exe_hook;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值