apache / pulsar-client-node

Apache Pulsar NodeJS Client
https://pulsar.apache.org/
Apache License 2.0
148 stars 86 forks source link

fix: Compatible with Node 12.3.0 and higher versions. #378

Closed shibd closed 7 months ago

shibd commented 7 months ago

Motivation

After #301, will use the Mozilla CA certificate provided by the node.js. And use the fs.rmSync API to generate a local ca when install.

But the fs.rmSync was introduced in Node.js v14.14.0, so an error will occur when installing now.

TypeError: fs.rmSync is not a function

Modifications

Verifying this change

Test on ubuntu-22.04

Use node.js v12.3.0 can work.

gitpod /workspace/pulsar-client-node (compatible_version) $ npm install
npm WARN read-shrinkwrap This version of npm is compatible with lockfileVersion@1, but package-lock.json was generated for lockfileVersion@2. I'll try to do my best with it!

> pulsar-client@1.12.0-rc.0 install /workspace/pulsar-client-node
> node-pre-gyp install --fallback-to-build && node GenCertFile.js

[pulsar-client] Success: "/workspace/pulsar-client-node/lib/binding/pulsar.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.3.2 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 746 packages from 559 contributors and audited 748 packages in 10.463s
found 6 moderate severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

Documentation