moleculerjs / moleculer

:rocket: Progressive microservices framework for Node.js
https://moleculer.services/
MIT License
6.09k stars 578 forks source link

Installation fails for Node 20 LTS #1271

Closed marceliwac closed 4 months ago

marceliwac commented 5 months ago

:stop_sign: Do you want to ask a question ?

Please head to the Discord chat

Prerequisites

Please answer the following questions for yourself before submitting an issue.

Current Behavior

Installation fails after cloning the repository and running npm install with Node 20.

Expected Behavior

Installation does not fail on Node 20.

Failure Information

node-gyp seems to be a culprit (see logs).

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Install Node 20
  2. git clone git@github.com:moleculerjs/moleculer.git
  3. cd moleculer
  4. npm i

Context

Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.

Failure Logs

marceli@~/Desktop$ git clone https://github.com/moleculerjs/moleculer.git
Cloning into 'moleculer'...
remote: Enumerating objects: 32081, done.
remote: Counting objects: 100% (3031/3031), done.
Rmote: Compressing objects:   4% (38/926)
remote: Compressing objects: 100% (926/926), done.
Rceiving objects:   0% (1/32081)
remote: Total 32081 (delta 2187), reused 2843 (delta 2093), pack-reused 29050
Receiving objects: 100% (32081/32081), 28.01 MiB | 2.90 MiB/s, done.
Resolving deltas: 100% (23949/23949), done.

marceli@~/Desktop$ cd moleculer

marceli@~/Desktop/moleculer$ npm i

npm WARN old lockfile 
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile 
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile 
npm WARN deprecated @types/pino@7.0.5: This is a stub types definition. pino provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/error-stack-parser@2.0.0: This is a stub types definition for error-stack-parser (https://github.com/stacktracejs/error-stack-parser). error-stack-parser provides its own type definitions, so you don't need @types/error-stack-parser installed!
npm WARN deprecated source-map-resolve@0.6.0: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated abab@2.0.6: Use your platform's native atob() and btoa() methods instead
npm WARN deprecated winston-context@0.0.7: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated domexception@2.0.1: Use your platform's native DOMException instead
npm WARN deprecated w3c-hr-time@1.0.2: Use your platform's native performance.now() and performance.timeOrigin.
npm WARN deprecated sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
npm WARN deprecated multer@1.4.4: Multer 1.x is affected by CVE-2022-24434. This is fixed in v1.4.4-lts.1 which drops support for versions of Node.js before 6. Please upgrade to at least Node.js 6 and version 1.4.4-lts.1 of Multer. If you need support for older versions of Node.js, we are open to accepting patches that would fix the CVE on the main 1.x release line, whilst maintaining compatibility with Node.js 0.10.
npm WARN deprecated uuid@3.4.0: Please upgrade  to version 7 or higher.  Older versions may use Math.random() in certain circumstances, which is known to be problematic.  See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated dd-trace@0.36.3: The v0.x release line of dd-trace has reached End of Life! Please upgrade to the latest version of dd-trace to continue receiving updates.
npm ERR! code 1
npm ERR! path /Users/marceli/Desktop/moleculer/node_modules/event-loop-stats
npm ERR! command failed
npm ERR! command sh -c node-gyp rebuild
npm ERR! CXX(target) Release/obj.target/eventLoopStats/src/eventLoopStats.o
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@10.0.1
npm ERR! gyp info using node@20.10.0 | darwin | x64
npm ERR! gyp info find Python using Python version 3.11.6 found at "/usr/local/opt/python@3.11/bin/python3.11"
npm ERR! gyp info spawn /usr/local/opt/python@3.11/bin/python3.11
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args '/Users/marceli/.nvm/versions/node/v20.10.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 '/Users/marceli/Desktop/moleculer/node_modules/event-loop-stats/build/config.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/marceli/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args '-I',
npm ERR! gyp info spawn args '/Users/marceli/Library/Caches/node-gyp/20.10.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=/Users/marceli/Library/Caches/node-gyp/20.10.0',
npm ERR! gyp info spawn args '-Dnode_gyp_dir=/Users/marceli/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp',
npm ERR! gyp info spawn args '-Dnode_lib_file=/Users/marceli/Library/Caches/node-gyp/20.10.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args '-Dmodule_root_dir=/Users/marceli/Desktop/moleculer/node_modules/event-loop-stats',
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 spawn make
npm ERR! gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm ERR! In file included from ../src/eventLoopStats.cc:1:
npm ERR! In file included from ../../nan/nan.h:178:
npm ERR! ../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
npm ERR! typedef v8::Local<v8::AccessorSignature> Sig;
npm ERR!                   ~~~~^
npm ERR! In file included from ../src/eventLoopStats.cc:1:
npm ERR! ../../nan/nan.h:684:39: warning: 'IdleNotificationDeadline' is deprecated: Use MemoryPressureNotification() to influence the GC schedule. [-Wdeprecated-declarations]
npm ERR!     return v8::Isolate::GetCurrent()->IdleNotificationDeadline(
npm ERR!                                       ^
npm ERR! /Users/marceli/Library/Caches/node-gyp/20.10.0/include/node/v8-isolate.h:1291:3: note: 'IdleNotificationDeadline' has been explicitly marked deprecated here
npm ERR!   V8_DEPRECATE_SOON(
npm ERR!   ^
npm ERR! /Users/marceli/Library/Caches/node-gyp/20.10.0/include/node/v8config.h:550:39: note: expanded from macro 'V8_DEPRECATE_SOON'
npm ERR! # define V8_DEPRECATE_SOON(message) [[deprecated(message)]]
npm ERR!                                       ^
npm ERR! In file included from ../src/eventLoopStats.cc:1:
npm ERR! ../../nan/nan.h:2544:8: error: no matching member function for call to 'SetAccessor'
npm ERR!   tpl->SetAccessor(
npm ERR!   ~~~~~^~~~~~~~~~~
npm ERR! /Users/marceli/Library/Caches/node-gyp/20.10.0/include/node/v8-template.h:816:8: note: candidate function not viable: no known conversion from 'imp::Sig' (aka 'int') to 'SideEffectType' for 7th argument
npm ERR!   void SetAccessor(
npm ERR!        ^
npm ERR! /Users/marceli/Library/Caches/node-gyp/20.10.0/include/node/v8-template.h:809:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
npm ERR!   void SetAccessor(
npm ERR!        ^
npm ERR! 1 warning and 2 errors generated.
npm ERR! make: *** [Release/obj.target/eventLoopStats/src/eventLoopStats.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> (/Users/marceli/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm ERR! gyp ERR! System Darwin 23.2.0
npm ERR! gyp ERR! command "/Users/marceli/.nvm/versions/node/v20.10.0/bin/node" "/Users/marceli/.nvm/versions/node/v20.10.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd /Users/marceli/Desktop/moleculer/node_modules/event-loop-stats
npm ERR! gyp ERR! node -v v20.10.0
npm ERR! gyp ERR! node-gyp -v v10.0.1
npm ERR! gyp ERR! not ok

marceli@~/Desktop/moleculer$ npm --version
10.2.3

marceli@~/Desktop/moleculer$ node --version
v20.10.0

marceli@~/Desktop/moleculer$ python --version
Python 3.11.6

marceli@~/Desktop/moleculer$ which python
/usr/local/bin/python
davidnussio commented 4 months ago

The issue relates to the snappy kafka-node dependency. the problem has been resolved in the next branch. kafka-node dependency is no longer used. This was my problem with node 20

marceliwac commented 4 months ago

Thanks for the update!

icebob commented 4 months ago

And event-loop-stats and gc-stats libraries are not maintained but native libs which don't work with newer Node versions. Both also removed in next branch.