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

Failed to load plugin commitlint-plugin-jira-rules #6

Closed
reginilee opened this issue Mar 23, 2022 · 5 comments
Closed

Failed to load plugin commitlint-plugin-jira-rules #6

reginilee opened this issue Mar 23, 2022 · 5 comments

Comments

@reginilee
Copy link

reginilee commented Mar 23, 2022

Following are the steps I have done when I ran into this error.

  1. I have cloned the front-end boilerplate repo into my own private repository.
  2. I have ran yarn install.
  3. I have ran yarn serve.
  4. I am able to compile and run the app at http://localhost:8080/.
  5. I have created some files and modified some files as I began my development process.
  6. I opened up Command Prompt and ran the git add command, followed by git commit, with the intention of wanting to push my commits.
  7. Several pre-commit tests ran by default.
  8. The following error message is shown.
Failed to load plugin commitlint-plugin-jira-rules.
C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\lib\cli.js:112
        throw err;
        ^

MissingPluginError: Failed to load plugin commitlint-plugin-jira-rules: Cannot find module 'commitlint-plugin-jira-rules'
Require stack:
- C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\node_modules\@commitlint\load\lib\utils\load-plugin.js
- C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\node_modules\@commitlint\load\lib\load.js
- C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\lib\cli.js
- C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\cli.js
    at loadPlugin (C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\node_modules\@commitlint\load\lib\utils\load-plugin.js:33:23)
    at C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\node_modules\@commitlint\load\lib\load.js:54:53
    at Array.forEach (<anonymous>)
    at load (C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\node_modules\@commitlint\load\lib\load.js:52:53)
    at async main (C:\Users\hp\AppData\Roaming\npm\node_modules\@commitlint\cli\lib\cli.js:175:20) {
  messageTemplate: 'plugin-missing',
  messageData: {
    pluginName: 'commitlint-plugin-jira-rules',
    commitlintPath: 'C:\\Users\\hp\\AppData\\Roaming\\npm\\node_modules\\@commitlint\\cli\\node_modules\\@commitlint\\load'
  }
}
husky - commit-msg hook exited with code 1 (error)

I found a similar issue faced in conventional-changelog/commitlint#2481, however there were no solutions found. The author mentioned a difference in versions of the @commitlint/cli and that may be the root cause. I ran @commitlint/cli -v on Command Prompt and found that my version is 16.2.3, while the version stated for @commitlint/cli under devDependencies in the repo's package.json is ^13.2.0, but I am not sure if this is truly the root cause.

As I am unable to git commit, I could not git push my changes, which makes it difficult for me to continue coding as I do not want to push a big number of changes at once.

I have been trying to look for answers and will continue looking, however I would like to raise this issue here hoping to get some assistance as this has been hindering my development process. Appreciate any assistance. Thank you!

@ChenRen93
Copy link
Contributor

Hi @reginilee, nice to meet you. I have cloned the repository and upgraded the commitlint/cli package to 16.2.3 but could not replicate the error you are facing. Have you tried to remove node_module and yarn install again?

@reginilee
Copy link
Author

Hi @ChenRen93, yes, I have tried removing node_module and yarn install again. Since I have an ongoing final year project, I do not want to risk changing my local environment. Thus, I have created a virtual machine to work on this. After setting up the environment, cloning my private repository, running yarn install and yarn serve, I added some files and ran git commit. I received the following response:

yarn run v1.22.18
$ vue-cli-service lint
 DONE  No lint errors found!
Done in 6.30s.
yarn run v1.22.18
$ vue-cli-service test:unit
PASS src/components/__tests__/example.spec.js
  HelloWorld.vue
    √ renders props.msg when passed (59ms)

-----------------|----------|----------|----------|----------|-------------------|
File             |  % Stmts | % Branch |  % Funcs |  % Lines | Uncovered Line #s |
-----------------|----------|----------|----------|----------|-------------------|
All files        |     5.56 |      100 |        0 |     5.88 |                   |
 components      |     8.33 |      100 |        0 |     9.09 |                   |
  CatCard.vue    |        0 |      100 |      100 |        0 |                 7 |
  CatTable.vue   |        0 |      100 |        0 |        0 |... 23,24,28,29,31 |
  HelloWorld.vue |      100 |      100 |      100 |      100 |                   |
 router          |        0 |      100 |      100 |        0 |                   |
  index.js       |        0 |      100 |      100 |        0 |              5,26 |
 store           |        0 |        0 |        0 |        0 |                   |
  index.js       |        0 |        0 |        0 |        0 |                   |
 views           |        0 |      100 |      100 |        0 |                   |
  About.vue      |        0 |      100 |      100 |        0 |              9,11 |
  Home.vue       |        0 |      100 |      100 |        0 |             10,12 |
-----------------|----------|----------|----------|----------|-------------------|
Test Suites: 1 passed, 1 total
Tests:       1 passed, 1 total
Snapshots:   0 total
Time:        5.317s
Ran all test suites.
Done in 7.86s.
.husky/commit-msg: line 4: commitlint: command not found
husky - commit-msg hook exited with code 127 (error)

For testing purposes, I have tried adding --no-verify behind my git commit command, and that allowed me to commit and push my changes to my repo. However, I understand that that is not a good practice.

May I know if the commitlint: command not found error above is due to, perhaps, my commit message not following a certain format? If so, what should the format be? Or have I misunderstood the problem? Thank you in advance.

@ChenRen93
Copy link
Contributor

ChenRen93 commented Mar 24, 2022

Hi @reginilee, I checked the repository and noted that there is an error in the current .husky pre-commit file, thank you for discovering the issue. To solve the problem on ur current repository, could you change the command in husky commit-msg file to yarn commitlint --edit instead of the current commitlint --edit. Thank you for finding the bugs in the code, i will fix the current codebase asap

@ChenRen93
Copy link
Contributor

For the commit lint format, we are using commitlint-plugin-jira-rules plugin.

Reference:
https://github.com/Gherciu/commitlint-jira#readme

@reginilee
Copy link
Author

Understood. I am able to git commit in the virtual environment now! Thank you.

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

No branches or pull requests

2 participants