Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't install Canvas - Node v12.18.0, Windows #1650

Closed
GwenBebe opened this issue Aug 14, 2020 · 6 comments
Closed

Can't install Canvas - Node v12.18.0, Windows #1650

GwenBebe opened this issue Aug 14, 2020 · 6 comments

Comments

@GwenBebe
Copy link

GwenBebe commented Aug 14, 2020

I went through the installation instructions, installing GTK, libjpeg-turbo, and node-gyp, however when I attempt to install canvas by running npm install canvas, I get this.


> canvas@2.6.1 install C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using needle for node-pre-gyp https download
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.6.1 and node@12.18.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error Remote end closed socket abruptly.
node-pre-gyp WARN Pre-built binaries not installable for canvas@2.6.1 and node@12.18.0 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
node-pre-gyp WARN Hit error ENOENT: Cannot cd into 'C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\Release'
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  Backend.cc
  ImageBackend.cc
  PdfBackend.cc  
  SvgBackend.cc  
  BMPParser.cc   
  Backends.cc
  Canvas.cc
  CanvasGradient.cc
  CanvasPattern.cc
  CanvasRenderingContext2d.cc
  closure.cc
  color.cc
  Backend.cc
  ImageBackend.cc
  PdfBackend.cc
  SvgBackend.cc
  BMPParser.cc
  Backends.cc
  Canvas.cc
  CanvasGradient.cc
  CanvasPattern.cc
  CanvasRenderingContext2d.cc
  closure.cc
  color.cc
  Image.cc
C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\color.cc : fatal error C1083: Cannot open compiler generated file: 'C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\Relea
se\obj\canvas\color.obj': Permission denied [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\backend\PdfBackend.cc)
 [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
  ImageData.cc
  init.cc
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\Backends.cc) [C:\Users
\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
  register_font.cc
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\backend\SvgBackend.cc)
 [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
  win_delay_load_hook.cc
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\closure.cc) [C:\Users\
creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\closure.cc) [C:\Users\
creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\backend\SvgBackend.cc)
 [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\backend\Backend.cc : fatal error C1083: Cannot open compiler generated file: 'C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\b
uild\Release\obj\canvas\Backend.obj': Permission denied [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\Canvas.cc) [C:\Users\c
reep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\Backends.cc) [C:\Users
\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\Canvas.cc) [C:\Users\c 
reep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
c:\users\creep\desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\closure.h(6): fatal error C1083: Cannot open include file: 'jpeglib.h': No such file or directory (compiling source file ..\src\backend\PdfBackend.cc)
 [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\src\CanvasRenderingContext2d.cc : fatal error C1083: Cannot open compiler generated file: 'C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules
\canvas\build\Release\obj\canvas\CanvasRenderingContext2d.obj': Permission denied [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
cl : Command line error D8040: error creating or communicating with child process [C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\canvas.vcxproj]
gyp ERR! build error 
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "build" "--fallback-to-build" "--module=C:\\Users\\creep\\Desktop\\autumn-forest\\autumn-bot-ts\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=C:\\Users\\creep\\Desktop\\autumn-forest\\autumn-bot-ts\\node_modules\\canvas\\build\\Release" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v72"
gyp ERR! cwd C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas
gyp ERR! node -v v12.18.0
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
node-pre-gyp ERR! build error 
node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\Release --napi_version=6 --node_abi_napi=napi 
--napi_build_version=0 --node_napi_label=node-v72' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1021:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
node-pre-gyp ERR! System Windows_NT 10.0.18363
node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\creep\\Desktop\\autumn-forest\\autumn-bot-ts\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
gypnode-pre-gyp ERR! cwd C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas
 node-pre-gypERR!  ERR!build error
node -v v12.18.0
node-pre-gyp ERR! gypnode-pre-gyp -v  v0.11.0
ERR!node-pre-gyp stack  Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
ERR!gyp  ERR!not ok
stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
Failed to execute 'C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\creep\Desktop\autumn-forest\autumn-bot-ts\node_modules\canvas\build\Release --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v72' (1)
gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
npm WARN autumn-bot-ts@1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! canvas@2.6.1 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the canvas@2.6.1 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\creep\AppData\Roaming\npm-cache\_logs\2020-08-14T04_05_57_175Z-debug.log```
@zbjornson
Copy link
Collaborator

Hit error Remote end closed socket abruptly.

This is due to an upstream issue in the module that downloads prebuilds and manifests in Node v12.16.3 and later only. That issue is fixed and node-canvas has been updated to use it, but we're currently stuck trying to make prebuilds.

Workarounds:

  • Add request to your package.json. node-pre-gyp will automatically use that instead of needle.
  • Use an earlier version of Node.js
  • Build from source (see readme)

@garganant
Copy link

I am also facing the same issue

@deepmistri
Copy link

Hit error Remote end closed socket abruptly.

This is due to an upstream issue in the module that downloads prebuilds and manifests in Node v12.16.3 and later only. That issue is fixed and node-canvas has been updated to use it, but we're currently stuck trying to make prebuilds.

Workarounds:

  • Add request to your package.json. node-pre-gyp will automatically use that instead of needle.
  • Use an earlier version of Node.js
  • Build from source (see readme)

I'm unable to solve this issue.so, can you please suggest me some steps to solve this error and which node version is compatible with this error?

@dschinkel
Copy link

dschinkel commented Oct 21, 2020

same issue
1684

and it's not acceptable to downgrade my version of Node. I was using 14, tried 15, even tried 12 and I am not downgrading my entire app for this.

@zbjornson
Copy link
Collaborator

This was fixed in Canvas 2.7.0 🎉

@Bobec
Copy link

Bobec commented May 31, 2021

And now is broken again

C:\Users\CIB2CLJ\Desktop\demo-spectrum\node-express-demo-master\node_modules\canvas
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! Warning: Missing input files:
npm ERR! C:\GTK\bin\libgthread-2.0-0.dll
npm ERR! C:\GTK\bin\libfreetype-6.dll
npm ERR! C:\GTK\bin\libpangoft2-1.0-0.dll
npm ERR! C:\GTK\bin\libexpat-1.dll
npm ERR! C:\GTK\bin\libpng14-14.dll
npm ERR! C:\GTK\bin\libfontconfig-1.dll
npm ERR! C:\GTK\bin\libglib-2.0-0.dll
npm ERR! C:\GTK\bin\libgobject-2.0-0.dll
npm ERR! C:\GTK\bin\libpango-1.0-0.dll
npm ERR! C:\GTK\bin\libgmodule-2.0-0.dll
npm ERR! C:\GTK\bin\libpangocairo-1.0-0.dll
npm ERR! C:\GTK\bin\libintl-8.dll
npm ERR! C:\GTK\bin\libpangowin32-1.0-0.dll
npm ERR! C:\GTK\bin\libcairo-2.dll
npm ERR! C:\GTK\bin\zlib1.dll
npm ERR! Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
npm ERR!   Backend.cc
npm ERR! C:\Users\CIB2CLJ\Desktop\demo-spectrum\node-express-demo-master\node_modules\canvas\src\backend\Backend.h(3,10): fatal error C1083: Cannot open include file: 'cairo.h': No such file or directory [C:\Users\CIB2CLJ\Desktop\demo-spectrum\node-express-demo-master\node_modules\canvas\build\canvas.vcxproj]
npm ERR! Failed to execute 'C:\Program Files (x86)\nodejs\node.exe C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js build --fallback-to-build --module=C:\Users\CIB2CLJ\Desktop\demo-spectrum\node-express-demo-master\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Users\CIB2CLJ\Desktop\demo-spectrum\node-express-demo-master\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v93' (1)

my package.json is
"cookie-parser": "~1.4.4", "debug": "~2.6.9", "express": "~4.16.1", "http-errors": "~1.6.3", "morgan": "~1.9.1", "pug": "2.0.0-beta11", "canvas": "^2.7.0", "face-api.js": "^0.22.2", "next": "10.x", "react": "17.x", "react-dom": "17.x"

but if I remove canvas from package.json npm install will be up and running.
Do you know how to solve this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants