Cannot find module "@commitlint/config-conventional" when running commintlint globally
See original GitHub issueExpected Behavior
I installed commitlint
and commitlint/config-conventional
globally, thus running echo 'hello world' | commitlint
under any directory should works.
Current Behavior
The command raises an exception.
/usr/local/lib/node_modules/@commitlint/cli/lib/cli.js:67
throw err;
^
Error: Cannot find module "@commitlint/config-conventional" from "/home/fabrizio"
at resolveId (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/resolve-extends/lib/index.js:134:12)
at resolveConfig (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/resolve-extends/lib/index.js:111:18)
at /usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/resolve-extends/lib/index.js:63:18
at Array.reduce (<anonymous>)
at loadExtends (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/resolve-extends/lib/index.js:61:32)
at resolveExtends (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/resolve-extends/lib/index.js:44:17)
at Object.$If_1 (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/load.js:90:46)
at Object.<anonymous> (/usr/local/lib/node_modules/@commitlint/cli/node_modules/@commitlint/core/lib/load.js:159:18)
at <anonymous>
Affected packages
- cli
- config-conventional
Steps to Reproduce (for bugs)
npm install -g @commitlint/cli @commitlint/config-conventional
echo "module.exports = {extends: ['@commitlint/config-conventional']};" > ~/.commitlintrc.js
echo 'should fail' | commitlint
commitlint.config.js
```js module.exports = {extends: ['@commitlint/config-conventional']}; ```Your Environment
Executable | Version |
---|---|
commitlint --version |
7.5.2 |
git --version |
2.17.1 |
node --version |
8.10.0 |
Issue Analytics
- State:
- Created 4 years ago
- Reactions:26
- Comments:35 (8 by maintainers)
Top Results From Across the Web
@commitlint/config-conventional - npm
Start using @commitlint/config-conventional in your project by running `npm i @commitlint/config-conventional`. There are 927 other projects ...
Read more >@commitlint/config-conventional | Yarn - Package Manager
Fast, reliable, and secure dependency management.
Read more >commitlint - Lint commit messages
commitlint helps your team adhere to a commit convention. By supporting npm-installed configurations it makes sharing of commit conventions easy.
Read more >reactjs - Jest - Referencing local files gives package link error
When I try and run jest, I get the following error that makes my test file fail: The package 'sdk-test-project' doesn't seem to...
Read more >Rush and Commitlint - DEV Community
First, configure commitlint to use conventional config. ... Next time you run git commit , Git will find your script and invoke it....
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I think commitlint is usually being used on a per project basis. So each project has it’s own config. If you want to use it globally like you tried you could use the
--config
option and try this:Workaround for those in the same case as me, manually include the rules from your chosen config in your
commitlint.config.js
config file.Here are the rules for
@commitlint/config-conventional
in YAML:.commitlintrc.yaml