2.x series fails to work in NPM scripts
lanesawyer opened this issue · comments
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
npx git-cliff@2.2.1
(although any 2.#.# version fails too)- 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
Thanks for opening your first issue at git-cliff! Be sure to follow the issue template! ⛰️
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
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.
I did a bit of playing with things this afternoon to find which versions worked.
In an empty directory I did the following:
nvm install [insert version here]
- Ran
npx git-cliff
- 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
?
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.