Skip to content

fix: Bun cannot run commitlint globally #4285

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

Closed
1 of 4 tasks
ParzivalVulpine opened this issue Feb 16, 2025 · 3 comments
Closed
1 of 4 tasks

fix: Bun cannot run commitlint globally #4285

ParzivalVulpine opened this issue Feb 16, 2025 · 3 comments
Labels

Comments

@ParzivalVulpine
Copy link

Steps to Reproduce

On a M1 MacBook Pro running macOS 15.3
1. Run `bun install -g @commitlint/{cli,config-conventional}`
2. Run `echo "module.exports = {extends: ['@commitlint/config-conventional']};" > ~/.commitlintrc.js`
3. Run `echo 'should fail' | commitlint --config ~/.commitlintrc.js`

Current Behavior

Image
file:///Users/parzv/.bun/install/global/node_modules/@commitlint/cli/lib/cli.js:132
        throw err;
        ^

Error: Cannot find module "@commitlint/config-conventional" from "/Users/parzv"
    at resolveId (file:///Users/parzv/.bun/install/global/node_modules/@commitlint/resolve-extends/lib/index.js:148:17)
    at resolveConfig (file:///Users/parzv/.bun/install/global/node_modules/@commitlint/resolve-extends/lib/index.js:132:20)
    at file:///Users/parzv/.bun/install/global/node_modules/@commitlint/resolve-extends/lib/index.js:93:26
    at Array.reduce (<anonymous>)
    at loadExtends (file:///Users/parzv/.bun/install/global/node_modules/@commitlint/resolve-extends/lib/index.js:92:22)
    at resolveExtends (file:///Users/parzv/.bun/install/global/node_modules/@commitlint/resolve-extends/lib/index.js:76:28)
    at load (file:///Users/parzv/.bun/install/global/node_modules/@commitlint/load/lib/load.js:47:28)
    at async main (file:///Users/parzv/.bun/install/global/node_modules/@commitlint/cli/lib/cli.js:200:20) {
  code: 'MODULE_NOT_FOUND'
}

Node.js v23.7.0

Expected Behavior

Should output the linters analysis on my message

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

No response

Context

I was interested in using bun for JS development and tried to install the cli utility to run globally through bun.

commitlint --version

@commitlint/[email protected]

git --version

git version 2.39.5 (Apple Git-154)

node --version

v23.7.0

@ParzivalVulpine
Copy link
Author

I want to note, that I accidentally discovered that apparently if I install @commitlint/config-conventional through npm, it seems to work (with commitlint installed from bun)

Image

I assume this is not intended behavior and it would be best for commitlint and config-conventional to work from just installing them through bun like I detailed above in my issue.

@escapedcat
Copy link
Member

This might be related to or duplicates #613 ?

@rubin55
Copy link

rubin55 commented Feb 25, 2025

This is not macos-specific (encountering this on Arch Linux). I'm running into the same issue with no obvious fix; I want to install commitlint globally; I've tried many invocations of commitlint, combined with all kinds of commitlintrc[ts/mjs/js/etc] but I CAN'T get it to work at all. Why is this so hard?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

3 participants