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

Getting error while installing canvas using npm #3047

Open
rahuljustbaat opened this issue Jul 16, 2024 · 7 comments
Open

Getting error while installing canvas using npm #3047

rahuljustbaat opened this issue Jul 16, 2024 · 7 comments
Labels

Comments

@rahuljustbaat
Copy link

rahuljustbaat commented Jul 16, 2024

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.

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
Copy link
Author

Please help!

@cclauss cclauss added the macOS label Jul 16, 2024
@cclauss
Copy link
Contributor

cclauss commented Jul 16, 2024

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>

@rahuljustbaat
Copy link
Author

rahuljustbaat commented Jul 16, 2024

@cclauss yes, did all the steps
Automattic/node-canvas#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

@cclauss
Copy link
Contributor

cclauss commented Jul 16, 2024

@fatimatugunbaeva
Copy link

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

@cclauss
Copy link
Contributor

cclauss commented Jul 24, 2024

Changing from what version to v3.9.13?

@amcc
Copy link

amcc commented Oct 15, 2024

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

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

No branches or pull requests

4 participants