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

npm intall not working on node v22 #2377

Open
1 task done
hong6316 opened this issue Apr 25, 2024 · 4 comments
Open
1 task done

npm intall not working on node v22 #2377

hong6316 opened this issue Apr 25, 2024 · 4 comments

Comments

@hong6316
Copy link

hong6316 commented Apr 25, 2024

Issue or Feature

npm intall not working on node v22.
I checked #1511 but the error log is not the same
I already proceed the below step but It's not working on node 22(other node versions work fine)
sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

https://app.travis-ci.com/github/enactjs/sandstone/jobs/620963689

npm ERR! code 1
npm ERR! path /home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas
npm ERR! command failed
npm ERR! command sh -c node-pre-gyp install --fallback-to-build --update-binary
npm ERR! make: Entering directory '/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build'
npm ERR!   SOLINK_MODULE(target) Release/obj.target/canvas-postbuild.node
npm ERR!   COPY Release/canvas-postbuild.node
npm ERR!   CXX(target) Release/obj.target/canvas/src/backend/Backend.o
npm ERR! make: Leaving directory '/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build'
npm ERR! Failed to execute '/home/travis/.nvm/versions/node/v22.0.0/bin/node /home/travis/.nvm/versions/node/v22.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@1.0.11
npm ERR! node-pre-gyp info using node@22.0.0 | linux | x64
npm ERR! (node:10122) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
npm ERR! (Use `node --trace-deprecation ...` to show where the warning was created)
npm ERR! node-pre-gyp http GET https://github.com/Automattic/node-canvas/releases/download/v2.11.2/canvas-v2.11.2-node-v127-linux-glibc-x64.tar.gz
npm ERR! 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-linux-glibc-x64.tar.gz 
npm ERR! node-pre-gyp WARN Pre-built binaries not installable for canvas@2.11.2 and node@22.0.0 (node-v127 ABI, glibc) (falling back to source compile with node-gyp) 
npm ERR! 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-linux-glibc-x64.tar.gz 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@22.0.0 | linux | x64
npm ERR! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@22.0.0 | linux | x64
npm ERR! gyp info find Python using Python version 3.7.17 found at "/opt/pyenv/versions/3.7.17/bin/python3"
npm ERR! gyp http GET https://nodejs.org/download/release/v22.0.0/node-v22.0.0-headers.tar.gz
npm ERR! gyp http 200 https://nodejs.org/download/release/v22.0.0/node-v22.0.0-headers.tar.gz
npm ERR! gyp http GET https://nodejs.org/download/release/v22.0.0/SHASUMS256.txt
npm ERR! gyp http 200 https://nodejs.org/download/release/v22.0.0/SHASUMS256.txt
npm ERR! gyp info spawn /opt/pyenv/versions/3.7.17/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/home/travis/.nvm/versions/node/v22.0.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 '/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/travis/.nvm/versions/node/v22.0.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/home/travis/.cache/node-gyp/22.0.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=/home/travis/.cache/node-gyp/22.0.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/home/travis/.nvm/versions/node/v22.0.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/home/travis/.cache/node-gyp/22.0.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/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! gyp info ok 
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.1.0
npm ERR! gyp info using node@22.0.0 | linux | x64
npm ERR! gyp info spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/backend/Backend.h:6,
npm ERR!                  from ../src/backend/Backend.cc:1:
npm ERR! ../../nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute, Nan::imp::Sig)’:
npm ERR! ../../nan/nan.h:2558:3: error: no matching function for call to ‘v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>&, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::Object>&, v8::AccessControl&, v8::PropertyAttribute&)’
npm ERR!  2558 |   );
npm ERR!       |   ^
npm ERR! In file included from /home/travis/.cache/node-gyp/22.0.0/include/node/v8-function.h:15,
npm ERR!                  from /home/travis/.cache/node-gyp/22.0.0/include/node/v8.h:33,
npm ERR!                  from /home/travis/.cache/node-gyp/22.0.0/include/node/node.h:73,
npm ERR!                  from ../../nan/nan.h:62,
npm ERR!                  from ../src/backend/Backend.h:6,
npm ERR!                  from ../src/backend/Backend.cc:1:
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1049:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, v8::AccessorGetterCallback, v8::AccessorSetterCallback, v8::Local<v8::Value>, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm ERR!  1049 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1052:61: note:   no known conversion for argument 5 from ‘v8::AccessControl’ to ‘v8::PropertyAttribute’
npm ERR!  1052 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm ERR!       |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1055:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm ERR!  1055 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1058:61: note:   no known conversion for argument 5 from ‘v8::AccessControl’ to ‘v8::PropertyAttribute’
npm ERR!  1058 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm ERR!       |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
npm ERR! In file included from ../src/backend/Backend.h:6,
npm ERR!                  from ../src/backend/Backend.cc:1:
npm ERR! ../../nan/nan.h: In function ‘void Nan::SetAccessor(v8::Local<v8::ObjectTemplate>, v8::Local<v8::String>, Nan::GetterCallback, Nan::SetterCallback, v8::Local<v8::Value>, v8::AccessControl, v8::PropertyAttribute)’:
npm ERR! ../../nan/nan.h:2601:3: error: no matching function for call to ‘v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>&, void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&), void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&), v8::Local<v8::Object>&, v8::AccessControl&, v8::PropertyAttribute&)’
npm ERR!  2601 |   );
npm ERR!       |   ^
npm ERR! In file included from /home/travis/.cache/node-gyp/22.0.0/include/node/v8-function.h:15,
npm ERR!                  from /home/travis/.cache/node-gyp/22.0.0/include/node/v8.h:33,
npm ERR!                  from /home/travis/.cache/node-gyp/22.0.0/include/node/node.h:73,
npm ERR!                  from ../../nan/nan.h:62,
npm ERR!                  from ../src/backend/Backend.h:6,
npm ERR!                  from ../src/backend/Backend.cc:1:
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1049:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::String>, v8::AccessorGetterCallback, v8::AccessorSetterCallback, v8::Local<v8::Value>, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm ERR!  1049 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1052:61: note:   no known conversion for argument 5 from ‘v8::AccessControl’ to ‘v8::PropertyAttribute’
npm ERR!  1052 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm ERR!       |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1055:8: note: candidate: ‘void v8::ObjectTemplate::SetAccessor(v8::Local<v8::Name>, v8::AccessorNameGetterCallback, v8::AccessorNameSetterCallback, v8::Local<v8::Value>, v8::PropertyAttribute, v8::SideEffectType, v8::SideEffectType)’
npm ERR!  1055 |   void SetAccessor(
npm ERR!       |        ^~~~~~~~~~~
npm ERR! /home/travis/.cache/node-gyp/22.0.0/include/node/v8-template.h:1058:61: note:   no known conversion for argument 5 from ‘v8::AccessControl’ to ‘v8::PropertyAttribute’
npm ERR!  1058 |       Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm ERR!       |                                           ~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~
npm ERR! make: *** [canvas.target.mk:159: Release/obj.target/canvas/src/backend/Backend.o] Error 1
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2
npm ERR! gyp ERR! stack at ChildProcess.<anonymous> (/home/travis/.nvm/versions/node/v22.0.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Linux 5.15.0-1049-gcp
npm ERR! gyp ERR! command "/home/travis/.nvm/versions/node/v22.0.0/bin/node" "/home/travis/.nvm/versions/node/v22.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "build" "--fallback-to-build" "--update-binary" "--module=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/Release/canvas.node" "--module_name=canvas" "--module_path=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/Release" "--napi_version=9" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v127"
npm ERR! gyp ERR! cwd /home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas
npm ERR! gyp ERR! node -v v22.0.0
npm ERR! gyp ERR! node-gyp -v v10.1.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 '/home/travis/.nvm/versions/node/v22.0.0/bin/node /home/travis/.nvm/versions/node/v22.0.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js build --fallback-to-build --update-binary --module=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/Release/canvas.node --module_name=canvas --module_path=/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas/build/Release --napi_version=9 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v127' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/@mapbox/node-pre-gyp/lib/util/compile.js:89:23)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (node:events:520:28)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (node:internal/child_process:1105:16)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:305:5)
npm ERR! node-pre-gyp ERR! System Linux 5.15.0-1049-gcp
npm ERR! node-pre-gyp ERR! command "/home/travis/.nvm/versions/node/v22.0.0/bin/node" "/home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/.bin/node-pre-gyp" "install" "--fallback-to-build" "--update-binary"
npm ERR! node-pre-gyp ERR! cwd /home/travis/build/enactjs/enact/packages/i18n/node_modules/@enact/ui-test-utils/node_modules/canvas
npm ERR! node-pre-gyp ERR! node -v v22.0.0
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: /home/travis/.npm/_logs/2024-04-25T05_35_01_147Z-debug-0.log

Steps to Reproduce

https://app.travis-ci.com/github/enactjs/sandstone/jobs/620963689

$ sudo apt-get update
$ sudo apt-get install build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

...

$ git clone --branch=develop --depth 1 https://github.com/enactjs/enact ../enact
$ pushd ../enact
$ npm install
$ npm run lerna exec -- --ignore enact-sampler --concurrency 1 -- npm --no-package-lock install
// etc.

Your Environment

  • Version of node-canvas (output of npm list canvas or yarn list canvas): v2.11.2
  • Environment (e.g. node 20.9.0 on macOS 14.1.1): node 22.0.0 on Ubuntu 20.04.6 LTS
nicolo-ribaudo added a commit to nicolo-ribaudo/pdf.js that referenced this issue Apr 26, 2024
Node.js 22 was just released, and it seems like it's not compatible
with the `canvas` package. This commit pins the version on GitHub
actions to Node.js 21 as a temporary workaround.

This commit should be reverted once
Automattic/node-canvas#2377
is fixed.
@nicolo-ribaudo
Copy link

Node.js 22 includes v8/v8@e48c472, which removed the v8::AccessControl settings parameter from v8::ObjectTemplate::SetAccessor.

v8::ObjectTemplate::SetAccessor(
  v8::Local<v8::String>&,
  void (*&)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value>&),
  void (*&)(v8::Local<v8::Name>, v8::Local<v8::Value>, const v8::PropertyCallbackInfo<void>&),
  v8::Local<v8::Object>&,
  v8::AccessControl&, // Removed!
  v8::PropertyAttribute&
)

#2235 probably fixed this problem by not using nan anymore, but it hasn't been released to npm yet.

@imrefazekas
Copy link

@hong6316 use

        "canvas": "Automattic/node-canvas#master",

in your package.json for the time being ... Works with node 22

domoritz added a commit to vega/vega-lite that referenced this issue Apr 30, 2024
domoritz added a commit to vega/vega that referenced this issue Apr 30, 2024
domoritz added a commit to vega/vega that referenced this issue Apr 30, 2024
domoritz added a commit to vega/vega-lite that referenced this issue Apr 30, 2024
@hong6316
Copy link
Author

hong6316 commented May 3, 2024

@hong6316 use

        "canvas": "Automattic/node-canvas#master",

in your package.json for the time being ... Works with node 22

That's not possible, I didn't add the canvas module directly to package.json.
The 3rd party module uses canvas.

@imrefazekas
Copy link

imrefazekas commented May 5, 2024

@hong6316
You can still use this npm feature: "overrides"?

https://github.com/npm/cli/releases/tag/v8.3.0

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

No branches or pull requests

3 participants