Closed krupis closed 5 months ago
I have figured out what was the issue.
If I use the command:
npx better-commits
Then it will work as expected.
I believe npx tells that this package is local
Short Answer: npm run better-commits
or npx better-commits
.
better-commits utilizes
On startup, better-commits
$HOME
directory. If it finds a config in the $HOME
directory, it will use your global config.$HOME
directory.I mention this first part, because you can run better-commits
on a per-repository basis, in any project. It doesn't have to be a project with package.json
or even a javascript/nodejs project.
For example, you can even install better-commits via the AUR, without directly installing npm (technically, under the hood, this still uses npm 😅).
To use better-commits
as a project-level package.json dependency. (This is specific to projects using package.json
)
npm install better-commits
(in your project directory)
Then add a script to your package.json
"scripts": {
"commit": "npm run better-commits"
}
Caveat: The script name can be anything, I just used commit
here.
Then in your project directory npm run commit
. This will run better-commits
using your projects node_modules
instead of your global `node_modules.
Hope this helps :)
Hello. I have been using globally installed
better-commits
(usingnpm install -g better-commits
) and everything was fine.Since we have many people on the team working on the same project (repository), I would like to install the
better-commits
package locally to the repository and upload thenode_modules
andpackage.json
to git to ensure that all team members can just simply use the package out of the boxI
cd
into my repository and installed thebetter-commits
locally usingnpm install better-commits
and uninstalled the global package usingnpm uninstall -g better-commits
. After that, I uploaded all the generated node files to the git.After I uninstalled the
better-commits
globally, I have tried to use the locally installedbetter-commits
but that does not seem to work even though thenpm list
says that I have the package installed:Could someone clarify to me what could be an issue and how to correctly use locally installed package?
My guess is that when I run
better-commits
it is looking fornode_modules
in the local directory which is:C:\Users\petrikas.lu\AppData\Roaming\npm\node_modules
However,
node_modules
exist in the project directory