joshbolduc / vscode-commitlint

commitlint integration for VS Code
MIT License
12 stars 1 forks source link

Error: Cannot find module #784

Open skwde opened 5 months ago

skwde commented 5 months ago

Something similar is already mentioned here https://github.com/joshbolduc/vscode-commitlint/issues/744 / https://github.com/joshbolduc/vscode-commitlint/issues/750.

I now have commitlint installed via a conda installed node (inside a container). I can use it without issues on the command line.

Following modules are installed

(base) root@213d29790eb9:/workspaces/docs# npm list -g
/opt/conda/lib
├── @commitlint/cli@19.2.1
├── @commitlint/config-conventional@19.1.0
├── corepack@0.20.0
└── npm@10.1.0

I have following commitlint.config.js in my project directory:

module.exports = {
    extends: ['@commitlint/config-conventional'],
};

and following commitlint related VSCode settings

    "commitlint.log.enabled": true,
    "commitlint.globalLibraryPath": "/opt/conda/lib",
    "commitlint.globalNodePath": "/opt/conda/bin/node",

playing with globalLibraryPath or setting preferBundledLibraries to true does not help and lead to the same problem.

joshbolduc commented 5 months ago

There may be multiple factors at play here, but I'd bet #753 is at least partly to blame. You could give 18.x a try in the meantime and see if that works.

skwde commented 5 months ago

Using @commitlint/config-conventional@18, i.e.

/opt/conda/lib
├── @commitlint/cli@19.2.1
├── @commitlint/config-conventional@18.6.3
├── corepack@0.20.0
└── npm@10.1.0

as you suggested indeed works, even without setting the path explicitly.

Note, when installing the package better reload the VSCode window.

joshbolduc commented 5 months ago

Reopening since #753 didn't fix this per @skwde:

@joshbolduc, I hate to bring the bad news, but it still seems broken for v19. #784 still doesn't work with extension version 2.6.0

# npm list -g
/opt/conda/lib
├── @commitlint/cli@19.3.0
├── @commitlint/config-conventional@19.2.2

And the extension output:

loading @commitlint/parse dynamically via /opt/conda/lib/node_modules/@commitlint/cli/node_modules/@commitlint/parse/lib/index.js
loading @commitlint/load dynamically via /opt/conda/lib/node_modules/@commitlint/cli/node_modules/@commitlint/load/lib/load.js
loading @commitlint/lint dynamically via /opt/conda/lib/node_modules/@commitlint/cli/node_modules/@commitlint/lint/lib/lint.js
Load config error stack:
Error: Cannot find module "@commitlint/config-conventional" from "/workspaces/docs"

The downgrade to v18.6.3 still works.

I haven't had a chance to investigate further and see what might have changed here in v19.