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

[BUG] 'Error: EACCES: permission denied' error when using @commitlint/config-nx-scopes #243

Open
jaytavares opened this issue Apr 27, 2022 · 5 comments
Assignees
Labels
help wanted Extra attention is needed

Comments

@jaytavares
Copy link

Describe the bug

Scopes are not loaded from @commitlint/config-nx-scopes. An error is logged in conventional commits extension output.

To reproduce

Steps to reproduce the behavior:

  1. Within an Nx workspace, create .commitlintrc file with contents:
{
  "extends": [
    "@commitlint/config-conventional",
    "@commitlint/config-nx-scopes"
  ]
}
  1. Activate conventional commits extension
  2. View conventional commits output

Expected behavior

Scopes should be loaded based on Nx workspace projects.

Screenshots

none

Application logs

[info] Extension Activated
[info] vscode.env.language: en
[info] last used version: 1.24.0
[info] Conventional commits started.
[info] VSCode version: 1.66.2
[info] Git version: 1.0.0
[info] VSCode Conventional Commits version: 1.24.0
[info] conventionalCommits.autoCommit: true
[info] conventionalCommits.silentAutoCommit: false
[info] conventionalCommits.emojiFormat: code
[info] conventionalCommits.gitmoji: true
[info] conventionalCommits.lineBreak:
[info] conventionalCommits.promptBody: true
[info] conventionalCommits.promptCI: false
[info] conventionalCommits.promptFooter: true
[info] conventionalCommits.promptScopes: true
[info] conventionalCommits.scopes:
[info] conventionalCommits.showEditor: false
[info] conventionalCommits.showNewVersionNotes: true
[info] conventionalCommits.editor.keepAfterSave: false
[info] git.enableSmartCommit: false
[info] git.smartCommitChanges: all
[info] git.postCommitCommand: none
[info] arg: undefined
[info] git.repositories: /Users/jay/dev/demo_project
[info] workspaceFolders: /Users/jay/dev/demo_project
[error] commitlint: The cwd is /Users/jay/dev/demo_project
[error] commitlint: Error: EACCES: permission denied, scandir '/Volumes/Backups of Jason’s MacBook Pro'
at Object.readdirSync (node:fs:1390:3)
at Object.e.readdirSync (node:electron/js2c/asar_bundle:5:10818)
at readdirWithFileTypes (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.scandir/out/providers/sync.js:16:33)
at Object.read (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.scandir/out/providers/sync.js:10:16)
at SyncReader.scandirSync [as _scandir] (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.scandir/out/index.js:17:17)
at SyncReader._handleDirectory (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.walk/out/readers/sync.js:28:34)
at SyncReader._handleQueue (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.walk/out/readers/sync.js:23:18)
at SyncReader.read (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.walk/out/readers/sync.js:15:14)
at SyncProvider.read (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.walk/out/providers/sync.js:11:29)
at ReaderSync.walkSync [as _walkSync] (/Users/jay/dev/demo_project/node_modules/@nodelib/fs.walk/out/index.js:19:21)
at ReaderSync.dynamic (/Users/jay/dev/demo_project/node_modules/fast-glob/out/readers/sync.js:13:21)
at ProviderSync.api (/Users/jay/dev/demo_project/node_modules/fast-glob/out/providers/sync.js:18:33)
at ProviderSync.read (/Users/jay/dev/demo_project/node_modules/fast-glob/out/providers/sync.js:13:30)
at Array.map ()
at getWorks (/Users/jay/dev/demo_project/node_modules/fast-glob/out/index.js:58:18)
at sync (/Users/jay/dev/demo_project/node_modules/fast-glob/out/index.js:19:23)
at globForProjectFiles (/Users/jay/dev/demo_project/node_modules/@nrwl/packages/nx/src/config/workspaces.ts:550:31)
at Workspaces.readWorkspaceConfiguration (/Users/jay/dev/demo_project/node_modules/@nrwl/packages/nx/src/config/workspaces.ts:81:13)
at /Users/jay/dev/demo_project/node_modules/@commitlint/config-nx-scopes/index.js:17:25
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at Object.execute (/Users/jay/.vscode/extensions/vivaxy.vscode-conventional-commits-1.24.0/dist/extension.js:650:19)
at async Promise.all (index 11)
at Object.load [as default] (/Users/jay/.vscode/extensions/vivaxy.vscode-conventional-commits-1.24.0/dist/extension.js:15586:29)
[info] commitlintRuleConfigs:
{}

@jaytavares jaytavares added the help wanted Extra attention is needed label Apr 27, 2022
@vivaxy
Copy link
Owner

vivaxy commented May 3, 2022

It seems the demo_project/node_modules/@nrwl/packages/nx/src/config/workspaces.ts is reading from /Volumes/Backups of Jason’s MacBook Pro with no permission granted.

@jaytavares
Copy link
Author

It seems the demo_project/node_modules/@nrwl/packages/nx/src/config/workspaces.ts is reading from /Volumes/Backups of Jason’s MacBook Pro with no permission granted.

That is the error message; however, there is no reference to that volume in my config nor should Nx be accessing it for any reason. It's just a time machine backup volume. The strange thing is that Commitizen has no problem running in the repo, which is why I posted this issue here instead of somewhere upstream.

It's a bit of a head scratcher. 🤔

@ChristopherMcDonald
Copy link

ChristopherMcDonald commented Dec 29, 2022

FWIW, I have the exact same problem. My errors are...

Conventional Commits: The cwd is /Users/christophermcdonald/repos/<hidden>

Conventional Commits: EBADF: bad file descriptor, lstat '/dev/fd/13'

FWIW, it looks like config-nx-scopes is exporting a rule config of "scope-enum" which looks like a "Supported Commitlint Rule". I would just guess when the rules are loaded, extensions are not being pulled in?

Also, commitlint pulls in the nx scopes fine.

git commit -m "test(none): test" --allow-empty   
⧗   input: test(none): test
✖   scope must be one of [applications, base-config, .... the rest of the nx apps and libs] [scope-enum]

✖   found 1 problems, 0 warnings
ⓘ   Get help: https://github.com/conventional-changelog/commitlint/#what-is-commitlint

husky - commit-msg hook exited with code 1 (error)

@marvinroman
Copy link

marvinroman commented Jul 20, 2024

I have a similar issue. It's not permissions related but rather require() of ES Module not supported..

I have a config which I use for Husky commit linting for team members that might not have the extension installed.

.commitlintrc.json with contents.

{
  "extends": ["@commitlint/config-conventional"]
}

The following errors occur in the extension.

[info] Conventional commits started.
[info] VSCode version: 1.91.1
[info] Git version: 1.0.0
[info] VSCode Conventional Commits version: 1.25.0
[info] conventionalCommits.autoCommit: true
[info] conventionalCommits.silentAutoCommit: false
[info] conventionalCommits.emojiFormat: code
[info] conventionalCommits.gitmoji: true
[info] conventionalCommits.lineBreak: \n
[info] conventionalCommits.promptBody: true
[info] conventionalCommits.promptCI: false
[info] conventionalCommits.promptFooter: true
[info] conventionalCommits.promptScopes: false
[info] conventionalCommits.scopes: 
[info] conventionalCommits.showEditor: true
[info] conventionalCommits.showNewVersionNotes: true
[info] conventionalCommits.editor.keepAfterSave: false
[info] git.enableSmartCommit: false
[info] git.smartCommitChanges: all
[info] git.postCommitCommand: none
[info] _arg: [Project Directory]
[info] git.repositories: [Project Directory]
[info] workspaceFolders: [Project Directory]
[error] commitlint: The cwd is [Project Directory]
[error] commitlint: Error [ERR_REQUIRE_ESM]: require() of ES Module [Project Directory]/node_modules/@commitlint/config-conventional/lib/index.js from [Home Directory]/.vscode/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js not supported.
Instead change the require of index.js in [Home Directory]/.vscode/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js to a dynamic import() which is available in all CommonJS modules.
    at c._load (node:electron/js2c/node_init:2:13672)
    at S._load (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:177:6035)
    at n._load (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:174:31788)
    at i._load (/opt/visual-studio-code/resources/app/out/vs/workbench/api/node/extensionHostProcess.js:139:34301)
    at h (/opt/visual-studio-code/resources/app/out/vs/loader.js:4:647)
    at [Home Directory]/.vscode/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22078:19
    at Array.reduce (<anonymous>)
    at loadExtends ([Home Directory]/.vscode/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22075:16)
    at Object.resolveExtends [as default] ([Home Directory]/.vscode/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:22061:22)
    at Object.load [as default] ([Home Directory]/.vscode/extensions/vivaxy.vscode-conventional-commits-1.25.0/dist/extension.js:21971:47)
[info] commitlintRuleConfigs:
{}

Is there anyway to have the extension just ignore the configuration?

@marvinroman
Copy link

marvinroman commented Jul 20, 2024

I was able to resolve by just adding the rules directly to .commitlintrc.json from @commitlint/config-conventional. Here they are as they exist at the time of this comment.

{
  "rules": {
    "body-leading-blank": [1, "always"],
    "body-max-line-length": [2, "always", 100],
    "footer-leading-blank": [1, "always"],
    "footer-max-line-length": [2, "always", 100],
    "header-max-length": [2, "always", 100],
    "header-trim": [2, "always"],
    "subject-case": [
      2,
      "never",
      ["sentence-case", "start-case", "pascal-case", "upper-case"]
    ],
    "subject-empty": [2, "never"],
    "subject-full-stop": [2, "never", "."],
    "type-case": [2, "always", "lower-case"],
    "type-empty": [2, "never"],
    "type-enum": [
      2,
      "always",
      [
        "build",
        "chore",
        "ci",
        "docs",
        "feat",
        "fix",
        "perf",
        "refactor",
        "revert",
        "style",
        "test"
      ]
    ]
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants