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

2.x series fails to work in NPM scripts #602

Closed
1 task done
lanesawyer opened this issue Apr 10, 2024 · 5 comments · Fixed by #621
Closed
1 task done

2.x series fails to work in NPM scripts #602

lanesawyer opened this issue Apr 10, 2024 · 5 comments · Fixed by #621
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers

Comments

@lanesawyer
Copy link
Contributor

Is there an existing issue for this?

  • I have searched the existing issues

Description of the bug

git-cliff fails to run through an NPM script or npx.

I thought the work done to fix #591 would have resolved my problem too, but that doesn't appear to be the case. I eagerly downloaded 2.2.1 and still ran into this 😢

> npx git-cliff -c cliff.toml -o CHANGELOG.md

file:///Users/lane.sawyer/dev/project-name/node_modules/git-cliff/lib/cli/cli.js:22
    throw new Error
Error: Couldn't find git-cliff binary inside node_modules for darwin-arm64 (TypeError: (intermediate value).resolve is not a function)

I see the same issue on my Linux machine too, it just complains about a different architecture (linux-x64).

I do see a git-cliff-darwin-arm64 and git-cliff-linux-x64 folders in my node_modules, and they both have executable inside so it's kinda weird... Not sure what's going on here.

Steps To Reproduce

  1. npx [email protected] (although any 2.#.# version fails too)
  2. See the error

Expected behavior

git-cliff works with NPM scripts

Screenshots / Logs

No response

Software information

  • Operating system: Mac OS and Ubuntu Linux (23.10)
  • Rust version: N/A
  • Node version: v18.13.0
  • Project version: v2.2.1

Additional context

No response

@lanesawyer lanesawyer added the bug Something isn't working label Apr 10, 2024
Copy link

welcome bot commented Apr 10, 2024

Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️

@lanesawyer
Copy link
Contributor Author

lanesawyer commented Apr 10, 2024

Oh goodness, after a little bit of poking it turns out that it's my Node version!

It failed on the version we're on at work (v18.13.0) and what I was on at home (v16.20.1 - 😱 why was I using that one at home lol)

It worked with the latest v18 and the latest v21!

Maybe let's pivot this bug to be that the NPM version of git-cliff should add supported Node version ranges to the package.json and docs? Or should I close this and open a new issue about the Node version?

That's a contribution that I'd be willing and able to do myself 😁 Just need to decide what versions are supported

@orhun
Copy link
Owner

orhun commented Apr 11, 2024

Hey, thanks for reporting and looking into this!

Maybe let's pivot this bug to be that the NPM version of git-cliff should add supported Node version ranges to the package.json and docs? Or should I close this and open a new issue about the Node version?

Are you interested in providing a pull request to mention the minimum supported Node version (which is =>18) in the NPM docs? (npm.md) I would highly appreciate that!

cc @favna for making sure about the Node version.

@orhun orhun added documentation Improvements or additions to documentation good first issue Good for newcomers labels Apr 20, 2024
@lanesawyer
Copy link
Contributor Author

I did a bit of playing with things this afternoon to find which versions worked.

In an empty directory I did the following:

  1. nvm install [insert version here]
  2. Ran npx git-cliff
  3. Made sure the CLI printed the "could not find repository" message, proving the binary successfully worked, otherwise I moved on to another version

Here are the lowest version number that I found that worked on each of the current main Node releases:

  • v18.19.0
  • v20.6.0
  • v21.0.0

I wouldn't mind if someone else wanted to do a quick sanity check that I got the right versions, just in case my Ubuntu machine has a weird quirk that isn't actually a true limitation on the version numbers below those I listed. My machine is quite old and sometimes breaks in silly ways because I poke at the configurations too much 😅

Given those versions I found while experimenting, should I change the engines field on the npm binary packages.json to >=18.19 || >=20.6 || >=21 to accurately reflect the working Node versions in addition to adding to npm.md?

@favna
Copy link
Contributor

favna commented Apr 22, 2024

Could've sworn I did reply something to this thread before, but I don't see any such comment anymore. Weird. Anyway, moving on. Yes, I would recommend setting the engines to those versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants