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

install error with node 18.9.0 #2257

Closed
1 task done
PengBoUESTC opened this issue Jun 12, 2023 · 5 comments
Closed
1 task done

install error with node 18.9.0 #2257

PengBoUESTC opened this issue Jun 12, 2023 · 5 comments

Comments

@PengBoUESTC
Copy link

Issue or Feature

npm ERR! code 1
npm ERR! path xx/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c -- node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | x64
npm ERR! gyp info find Python using Python version 3.10.6 found at "/usr/local/opt/[email protected]/bin/python3.10"
npm ERR! gyp info spawn /usr/local/opt/[email protected]/bin/python3.10
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   'xxx/.nvm/versions/node/v18.9.0/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'xxx/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'xx/.nvm/versions/node/v18.9.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   'xx/Library/Caches/node-gyp/18.9.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/xx/Library/Caches/node-gyp/18.9.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=xx/.nvm/versions/node/v18.9.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=xx/Library/Caches/node-gyp/18.9.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/xx/node_modules/canvas',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! /bin/sh: pkg-config: command not found
npm ERR! gyp: Call to 'pkg-config pixman-1 --libs' returned exit status 127 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (xx/.nvm/versions/node/v18.9.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:284:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:291:12)
npm ERR! gyp ERR! System Darwin 20.6.0
npm ERR! gyp ERR! command "xx/.nvm/versions/node/v18.9.0/bin/node" "/xx/.nvm/versions/node/v18.9.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /xxx/node_modules/canvas
npm ERR! gyp ERR! node -v v18.9.0
npm ERR! gyp ERR! node-gyp -v v9.1.0
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     /xxx/.npm/_logs/2023-06-12T09_09_52_894Z-debug-0.log

Your Environment

  • Version of node-canvas: 2.11.2
  • Environment: node 18.9.0 ; OS: macOS 11.6
@rsoaresdev
Copy link

node-canvas may not be compatible with Node 18 due to the lack of pre-compiled builds available for this particular version of Node.js. In a comment by one of the node-canvas package contributors, it was mentioned that there were no pre-compiled builds available for Node 18 at that time (source: #2052 (comment)).

Until pre-compiled builds are available for Node 18, you will need to install canvas using node v17. To do so, uninstall node v18 from your system and install node v17.9.1 (here is the link to install this version for x64 windows: https://nodejs.org/download/release/v17.9.1/node-v17.9.1-x64.msi)

@woxman
Copy link

woxman commented Jun 16, 2023

i cant use canvas in pdf-transform modul

i see this problem

`node:internal/modules/cjs/loader:1280
return process.dlopen(module, path.toNamespacedPath(filename));
^

Error: The specified procedure could not be found.
\?\D:\azarakhsh\node_modules\canvas\build\Release\canvas.node
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1280:18)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object. (D:\azarakhsh\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object. (D:\azarakhsh\node_modules\canvas\lib\canvas.js:9:18)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object. (D:\azarakhsh\node_modules\canvas\index.js:1:16)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object. (D:\azarakhsh\node_modules\filepix\lib\pdf2img.js:4:16)
at Module._compile (node:internal/modules/cjs/loader:1196:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1250:10)
at Module.load (node:internal/modules/cjs/loader:1074:32)
at Function.Module._load (node:internal/modules/cjs/loader:909:12)
at Module.require (node:internal/modules/cjs/loader:1098:19)
at require (node:internal/modules/cjs/helpers:108:18)
at Object. (D:\azarakhsh\node_modules\filepix\index.js:4:17) {
code: 'ERR_DLOPEN_FAILED'
}`

@lakshmikanth-reddy-au2
Copy link

lakshmikanth-reddy-au2 commented Aug 21, 2023

I am facing the similar issue. I even tried installing node v17. Bust still it did not help.

npm ERR! code 1
npm ERR! path C:\Portal test\Portal\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 --update-binary
npm ERR! Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\lbalam\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=C:\Portal test\Portal\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Portal test\Portal\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using [email protected]
npm ERR! node-pre-gyp info using [email protected] | win32 | x64
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v102-win32-unknown-x64.tar.gz
npm ERR! node-pre-gyp ERR! install request to https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v102-win32-unknown-x64.tar.gz failed, reason: unable to get local issuer certificate
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v102 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp WARN Hit error request to https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v102-win32-unknown-x64.tar.gz failed, reason: unable to get local issuer 
certificate
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | win32 | x64
npm ERR! gyp info find Python using Python version 3.11.4 found at "C:\Python311\python.exe"
npm ERR! gyp http GET https://nodejs.org/download/release/v17.9.1/node-v17.9.1-headers.tar.gz
npm ERR! gyp WARN install got an error, rolling back install
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack FetchError: request to https://nodejs.org/download/release/v17.9.1/node-v17.9.1-headers.tar.gz failed, reason: unable to get local issuer certificate
npm ERR! gyp ERR! stack     at ClientRequest.<anonymous> (C:\Users\lbalam\AppData\Roaming\npm\node_modules\npm\node_modules\minipass-fetch\lib\index.js:130:14)
npm ERR! gyp ERR! stack     at ClientRequest.emit (node:events:527:28)
npm ERR! gyp ERR! stack     at TLSSocket.socketErrorListener (node:_http_client:454:9)
npm ERR! gyp ERR! stack     at TLSSocket.emit (node:events:539:35)
npm ERR! gyp ERR! stack     at emitErrorNT (node:internal/streams/destroy:164:8)
npm ERR! gyp ERR! stack     at emitErrorCloseNT (node:internal/streams/destroy:129:3)
npm ERR! gyp ERR! stack     at processTicksAndRejections (node:internal/process/task_queues:83:21)
npm ERR! gyp ERR! System Windows_NT 10.0.19045
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\lbalam\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--update-binary" "--module=C:\\Portal test\\Portal\\node_modules\\canvas\\build\\Release\\canvas.node" "--module_name=canvas" "--module_path=C:\\Portal test\\Portal\\node_modules\\canvas\\build\\Release" "--napi_version=8" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v102"
npm ERR! gyp ERR! cwd C:\Portal test\Portal\node_modules\canvas
npm ERR! gyp ERR! node -v v17.9.1
npm ERR! gyp ERR! node-gyp -v v9.4.0
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\nodejs\node.exe C:\Users\lbalam\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --update-binary --module=C:\Portal test\Portal\node_modules\canvas\build\Release\canvas.node --module_name=canvas --module_path=C:\Portal test\Portal\node_modules\canvas\build\Release --napi_version=8 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v102' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Portal test\Portal\node_modules\@mapbox\node-pre-gyp\lib\util\compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1090:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.19045
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Portal test\\Portal\\node_modules\\@mapbox\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build" "--update-binary"     
npm ERR! node-pre-gyp ERR! cwd C:\Portal test\Portal\node_modules\canvas
npm ERR! node-pre-gyp ERR! node -v v17.9.1
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v1.0.11
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in: C:\Users\lbalam\AppData\Local\npm-cache\_logs\2023-08-21T09_13_21_949Z-debug-0.log

@goktug7913
Copy link

goktug7913 commented Sep 6, 2023

same error on our ubuntu oracle server tried with node 20 19 and 18 no change, but it installs with node 20 on my manjaro development machine

update: run this before installing
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

@paulo-roberto-rosa
Copy link

I am using Mac OSX with M1 Chip and I was not able to install dependencies and also not able to run unit tests because of that. After trying several solutions, I found out the cause, it was homebrew that was not configuring pkg-config properly after installing it.

So what solved was to use Mac Ports to install pkg-config and pango:
after running: sudo port install pkgconfig pango

and wait for long 40 minutes, I can finally install everything properly on the project and no more canvas errors showing up and I can finally run unit tests again :) thank god. i spent 1 week trying to solve that one.

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

7 participants