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

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

Merged
merged 1 commit into from
Apr 13, 2024

Conversation

shibd
Copy link
Member

@shibd shibd commented Apr 12, 2024

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

  • Use fs.existsSync and unlinkSync instead of fs.rmSync.
  • Since Mozilla CA requires a Node.js version greater than v12.3.0, the README and package.json should be modified to indicate that it is only compatible with versions 12.3.0 and above.

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

  • doc-required
    (Your PR needs to update docs and you will update later)

  • doc-not-needed
    (Please explain why)

  • doc
    (Your PR contains doc changes)

  • doc-complete
    (Docs have been already added)

@shibd shibd self-assigned this Apr 12, 2024
@shibd shibd added this to the 1.11.0 milestone Apr 12, 2024
@shibd shibd merged commit 2d659d2 into apache:master Apr 13, 2024
12 checks passed
shibd added a commit that referenced this pull request Apr 13, 2024
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

Successfully merging this pull request may close these issues.

2 participants