node-gyp icon indicating copy to clipboard operation
node-gyp copied to clipboard

Getting error while installing canvas using npm

Open rahuljustbaat opened this issue 1 year ago • 7 comments

Please look thru your error log for the string gyp info using node-gyp@ and if the version number is less than the current release of node-gyp then please upgrade using the instructions at https://github.com/nodejs/node-gyp/blob/main/docs/Updating-npm-bundled-node-gyp.md and try your command again.

Requests for help with node-sass are very common. Please be aware that this package is deprecated, you should seek alternatives and avoid opening new issues about it here.

  • Node Version:
  • Platform: <!-- `Mac OS X Sonama>
  • Compiler:
  • Module: <!-- canvas(https://www.npmjs.com/package/canvas) >
Verbose output (from npm or node-gyp):
Progress: resolved 1, reused 0, downloaded 0, added 0
Progress: resolved 21, reused 21, downloaded 0, added 0
Progress: resolved 44, reused 42, downloaded 0, added 0
Progress: resolved 255, reused 254, downloaded 0, added 0
Progress: resolved 403, reused 403, downloaded 0, added 0
Progress: resolved 411, reused 411, downloaded 0, added 0
 WARN  19 deprecated subdependencies found: @npmcli/[email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
Packages: +414
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Progress: resolved 414, reused 414, downloaded 0, added 0, done
.../.pnpm/[email protected]/node_modules/gl install$ prebuild-install || node-gyp rebuild
.../node_modules/canvas install$ node-pre-gyp install --fallback-to-build --update-binary
.../node_modules/canvas install: node-pre-gyp info it worked if it ends with ok
.../node_modules/canvas install: node-pre-gyp info using [email protected]
.../node_modules/canvas install: node-pre-gyp info using [email protected] | darwin | x64
.../node_modules/canvas install: (node:69584) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
.../node_modules/canvas install: (Use `node --trace-deprecation ...` to show where the warning was created)
.../node_modules/canvas install: node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-x64.tar.gz
.../.pnpm/[email protected]/node_modules/gl install: prebuild-install warn install No prebuilt binaries found (target=22.4.1 runtime=node arch=x64 libc= platform=darwin)
.../node_modules/canvas install: node-pre-gyp ERR! install response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-x64.tar.gz 
.../node_modules/canvas install: node-pre-gyp WARN Pre-built binaries not installable for [email protected] and [email protected] (node-v127 ABI, unknown) (falling back to source compile with node-gyp) 
.../node_modules/canvas install: node-pre-gyp WARN Hit error response status 404 Not Found on https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-darwin-unknown-x64.tar.gz 
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | darwin | x64
.../node_modules/canvas install: gyp info ok 
.../node_modules/canvas install: gyp info it worked if it ends with ok
.../node_modules/canvas install: gyp info using [email protected]
.../node_modules/canvas install: gyp info using [email protected] | darwin | x64
.../.pnpm/[email protected]/node_modules/gl install: gyp info it worked if it ends with ok
.../.pnpm/[email protected]/node_modules/gl install: gyp info using [email protected]
.../.pnpm/[email protected]/node_modules/gl install: gyp info using [email protected] | darwin | x64
.../.pnpm/[email protected]/node_modules/gl install: (node:69602) [DEP0060] DeprecationWarning: The `util._extend` API is deprecated. Please use Object.assign() instead.
.../.pnpm/[email protected]/node_modules/gl install: (Use `node --trace-deprecation ...` to show where the warning was created)
.../node_modules/canvas install: gyp info find Python using Python version 3.9.6 found at "/Users/rahulkathuria/Documents/justbaat/optimus/tts/tts_env/bin/python3"
.../.pnpm/[email protected]/node_modules/gl install: gyp info find Python using Python version 3.9.6 found at "/Users/rahulkathuria/Documents/justbaat/optimus/tts/tts_env/bin/python3"
.../node_modules/canvas install: gyp info spawn /Users/rahulkathuria/Documents/justbaat/optimus/tts/tts_env/bin/python3
.../node_modules/canvas install: gyp info spawn args [
.../node_modules/canvas install: gyp info spawn args '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
.../node_modules/canvas install: gyp info spawn args 'binding.gyp',
.../node_modules/canvas install: gyp info spawn args '-f',
.../node_modules/canvas install: gyp info spawn args 'make',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas/build/config.gypi',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
.../node_modules/canvas install: gyp info spawn args '-I',
.../node_modules/canvas install: gyp info spawn args '/Users/rahulkathuria/Library/Caches/node-gyp/22.4.1/include/node/common.gypi',
.../node_modules/canvas install: gyp info spawn args '-Dlibrary=shared_library',
.../node_modules/canvas install: gyp info spawn args '-Dvisibility=default',
.../node_modules/canvas install: gyp info spawn args '-Dnode_root_dir=/Users/rahulkathuria/Library/Caches/node-gyp/22.4.1',
.../node_modules/canvas install: gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
.../node_modules/canvas install: gyp info spawn args '-Dnode_lib_file=/Users/rahulkathuria/Library/Caches/node-gyp/22.4.1/<(target_arch)/node.lib',
.../node_modules/canvas install: gyp info spawn args '-Dmodule_root_dir=/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected][email protected]/node_modules/canvas',
.../node_modules/canvas install: gyp info spawn args '-Dnode_engine=v8',
.../node_modules/canvas install: gyp info spawn args '--depth=.',
.../node_modules/canvas install: gyp info spawn args '--no-parallel',
.../node_modules/canvas install: gyp info spawn args '--generator-output',
.../node_modules/canvas install: gyp info spawn args 'build',
.../node_modules/canvas install: gyp info spawn args '-Goutput_dir=.'
.../node_modules/canvas install: gyp info spawn args ]
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn /Users/rahulkathuria/Documents/justbaat/optimus/tts/tts_env/bin/python3
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args [
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/node-gyp/gyp/gyp_main.py',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   'binding.gyp',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-f',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   'make',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-I',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/gl/build/config.gypi',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-I',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/node-gyp/addon.gypi',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-I',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '/Users/rahulkathuria/Library/Caches/node-gyp/22.4.1/include/node/common.gypi',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dlibrary=shared_library',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dvisibility=default',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dnode_root_dir=/Users/rahulkathuria/Library/Caches/node-gyp/22.4.1',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dnode_gyp_dir=/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/node-gyp',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dnode_lib_file=/Users/rahulkathuria/Library/Caches/node-gyp/22.4.1/<(target_arch)/node.lib',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dmodule_root_dir=/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/gl',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Dnode_engine=v8',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '--depth=.',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '--no-parallel',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '--generator-output',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   'build',
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args   '-Goutput_dir=.'
.../.pnpm/[email protected]/node_modules/gl install: gyp info spawn args ]
.../.pnpm/[email protected]/node_modules/gl install: /bin/sh: python: command not found
.../.pnpm/[email protected]/node_modules/gl install: gyp: Call to 'python commit_id.py check ..' returned exit status 127 while in angle/src/angle.gyp. while loading dependencies of binding.gyp while trying to load binding.gyp
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! configure error 
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! stack Error: `gyp` failed with exit code: 1
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! stack     at ChildProcess.onCpExit (/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/node-gyp/lib/configure.js:325:16)
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! System Darwin 23.5.0
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! command "/usr/local/Cellar/node/22.4.1/bin/node" "/Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! cwd /Users/rahulkathuria/Documents/justbaat/layerhub-renderer/node_modules/.pnpm/[email protected]/node_modules/gl
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! node -v v22.4.1
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! node-gyp -v v9.4.1
.../.pnpm/[email protected]/node_modules/gl install: gyp ERR! not ok 
.../.pnpm/[email protected]/node_modules/gl install: Failed
 ELIFECYCLE  Command failed with exit code 1.

rahuljustbaat avatar Jul 16 '24 11:07 rahuljustbaat

Please help!

rahuljustbaat avatar Jul 16 '24 11:07 rahuljustbaat

Did you open an issue at https://github.com/Automattic/node-canvas ?

Did you do xcode-select --install as discussed in README.md and in https://www.npmjs.com/package/canvas ?

Did you do the brew install discussed in https://www.npmjs.com/package/canvas ?

https://github.com/nodejs/node-gyp/blob/main/docs/README.md#node-pre-gyp-is-no-longer-maintained is a problem that we are trying to fix.

On the error message:

.../.pnpm/[email protected]/node_modules/gl install: /bin/sh: python: command not found

You might try (all on one line): % python=python3 <your command>

cclauss avatar Jul 16 '24 13:07 cclauss

@cclauss yes, did all the steps https://github.com/Automattic/node-canvas/issues/2401

Also did % python=python3 command

Downgraded node from 22 to 20 and ugraded python from 3.9 to 3.12 for the canvas as mentioned in their issues related to installation guide but still no luck

rahuljustbaat avatar Jul 16 '24 14:07 rahuljustbaat

I was unable to make it fail:

  • https://github.com/Automattic/node-canvas/blob/66d5d231fbe0f532a5a2118494b091c7f27ffa1c/.github/workflows/ci.yaml#L12

cclauss avatar Jul 16 '24 22:07 cclauss

hey I also had this issue, changing the Python version to 3.9.13 fixed it for me

fatimatugunbaeva avatar Jul 24 '24 11:07 fatimatugunbaeva

Changing from what version to v3.9.13?

cclauss avatar Jul 24 '24 13:07 cclauss

none of this worked for me, however going here and following the compiling steps (for Mac OS X in my case) worked perfectly: https://www.npmjs.com/package/canvas

amcc avatar Oct 15 '24 05:10 amcc

  • Automattic/node-canvas#2465

cclauss avatar Dec 06 '24 05:12 cclauss

Please retry with the new node-pre-gyp v2. If this fails with v2, please provide a full error log, and I will reopen this issue.

cclauss avatar Jan 27 '25 11:01 cclauss