Skip to content

Commit dddbe77

Browse files
docs: add guide for fixing PATH-related issues after installation
1 parent e9a606c commit dddbe77

File tree

1 file changed

+55
-0
lines changed

1 file changed

+55
-0
lines changed

README.md

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ commitlint checks if your commit message meets the [conventional commit format](
3636
- [Commit Types](#commit-types)
3737
- [Available Rules](#available-rules)
3838
- [Available Formatters](#available-formatters)
39+
- [Common Installation Issues](#common-installation-issues)
3940
- [Extensibility](#extensibility)
4041
- [FAQ](#faq)
4142
- [License](#license)
@@ -247,6 +248,60 @@ Total 1 errors, 0 warnings, 0 other severities
247248
{"input":"fear: do not fear for commit message","issues":[{"description":"type 'fear' is not allowed, you can use one of [build chore ci docs feat fix perf refactor revert style test]","name":"type-enum","severity":"error"}]}
248249
```
249250

251+
## Common Installation Issues
252+
253+
If you encounter the `command not found: commitlint` error after installing `commitlint`, this likely means the binary is not in your system's `PATH`. Follow these steps to resolve this issue:
254+
255+
1. **Ensure `GOPATH/bin` is in your `PATH`**:
256+
By default, Go installs binaries to `$GOPATH/bin` or `$HOME/go/bin` if `GOPATH` is not set. Add this directory to your `PATH`:
257+
258+
```bash
259+
export PATH=$PATH:$GOPATH/bin
260+
```
261+
262+
Or, if `GOPATH` is not set:
263+
264+
```bash
265+
export PATH=$PATH:$HOME/go/bin
266+
```
267+
268+
Add this line to your shell configuration file (e.g., `~/.bashrc`, `~/.zshrc`) to make the change permanent:
269+
270+
```bash
271+
echo 'export PATH=$PATH:$HOME/go/bin' >> ~/.zshrc
272+
source ~/.zshrc
273+
```
274+
275+
2. **Verify the Installation**:
276+
Confirm that the `commitlint` binary is in the expected directory:
277+
278+
```bash
279+
ls $GOPATH/bin/commitlint
280+
```
281+
282+
Or:
283+
284+
```bash
285+
ls $HOME/go/bin/commitlint
286+
```
287+
288+
3. **Reinstall if Necessary**:
289+
If the binary is missing, reinstall `commitlint`:
290+
291+
```bash
292+
go install github.com/conventionalcommit/commitlint@latest
293+
```
294+
295+
4. **Post-Verification**:
296+
After following these steps, try running `commitlint` again:
297+
298+
```bash
299+
commitlint init --global
300+
```
301+
302+
This should allow `commitlint` to be recognized as a command in your terminal.
303+
304+
250305
## Extensibility
251306

252307
## FAQ

0 commit comments

Comments
 (0)