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

fix: Find Up dependancy #4209

Open
1 of 4 tasks
Joanneyoung01 opened this issue Dec 13, 2024 · 2 comments
Open
1 of 4 tasks

fix: Find Up dependancy #4209

Joanneyoung01 opened this issue Dec 13, 2024 · 2 comments
Labels

Comments

@Joanneyoung01
Copy link

Steps to Reproduce

1. First step
When using commitlint, I have used a conventional commit
2. Second step
Unable to commit due to the current behaviour

Current Behavior

Seeing the below error message

import { findUp } from ‘find-up’;
^^^^^^
SyntaxError: Named export ‘findUp’ not found. The requested module ‘find-up’ is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from ‘find-up’;
const { findUp } = pkg;

Expected Behavior

I should be able to commit correctly

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

I have added Find Up as a dependancy

"dependencies": {
"find-up": "^7.0.0"
}

Context

I would like to be able to remove this dependancy as it's a direct dependancy of the Commit Lint package, not required by my application

commitlint --version

@commitlint/cli": "^19.5.0"

git --version

git version 2.47.1

node --version

v20.9.0

@escapedcat
Copy link
Member

Can you create a minimal repo for reproduction?
Seems like #4208 was added by mistake and can be closed?

@escapedcat escapedcat mentioned this issue Dec 15, 2024
4 tasks
@iamfj
Copy link

iamfj commented Jan 13, 2025

Just reproduced the same issue. The workaround @Joanneyoung01 mentioned does not worked for me worked and is also not ideal in my opinion.

Packages Used

"devDependencies": {
  (...)
  "@commitlint/cli": "19.6.1",
  "@commitlint/config-conventional": "19.6.0",
  (...)
}

Log

file:///workspaces/***/node_modules/find-up/index.js:2
import {locatePath, locatePathSync} from 'locate-path';
        ^^^^^^^^^^
SyntaxError: Named export 'locatePath' not found. The requested module 'locate-path' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:

import pkg from 'locate-path';
const {locatePath, locatePathSync} = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:134:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:217:5)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)
    at async asyncRunEntryPointWithESMLoader (node:internal/modules/run_main:123:5)

Node.js v20.13.1

Workaround

The workaround i chose is going back to the following versions.

"devDependencies": {
  (...)
  "@commitlint/cli": "18.6.1",
  "@commitlint/config-conventional": "18.6.3",
  (...)
}

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