Skip to content

use [email protected], [email protected], @commitlint/[email protected], Cannot find module '@lerna/project' error #3579

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
4 tasks
liangskyli opened this issue Apr 6, 2023 · 2 comments
Labels

Comments

@liangskyli
Copy link

Expected Behavior

Expected:Can submit code normally without reporting errors!

Current Behavior

"@commitlint/config-lerna-scopes": "^17.4.2",
"lerna": "6.6.1",
[email protected]

when i use [email protected], commit code with error:

Error: Cannot find module '@lerna/project'
Require stack:
- xxx\noop.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (xxx\node_modules\.pnpm\@[email protected]\node_modules\@cspotcode\source-map-support\source-map-support.js:811:30)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at module.exports (xxx\node_modules\.pnpm\[email protected]\node_modules\import-from\index.js:5:100)
    at xxx\node_modules\.pnpm\@[email protected][email protected]\node_modules\@commitlint\config-lerna-scopes\index.js:45:26
    at async execute (xxx\node_modules\.pnpm\@[email protected]\node_modules\@commitlint\execute-rule\src\index.ts:20:16)
    at async Promise.all (index 11)
    at async load (xxx\node_modules\.pnpm\@[email protected]\node_modules\@commitlint\load\src\load.ts:78:3) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'E:\\xxx\\noop.js' ]
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
husky - commit-msg hook exited with code 1 (error)

I noticed an error in this position:
@commitlint/config-lerna-scopes/index.js this file:

// Cannot find module '@lerna/project'
const {getPackages} = importFrom(cwd, '@lerna/project');

because [email protected] doesn't have this package anymore(@lerna/project)
but have this package(@lerna/project) in [email protected] version

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

@commitlint/config-lerna-scopes/index.js

// fix this code, lerna doesn't have this package anymore(@lerna/project)
const {getPackages} = importFrom(cwd, '@lerna/project');

Steps to Reproduce

1. First step
use "@commitlint/cli": "^17.5.0","@commitlint/config-conventional": "^17.4.4","@commitlint/config-lerna-scopes": "^17.4.2","lerna": "6.6.1","lint-staged": "^13.2.0",[email protected]
use pnpm install package 

2. Second step
commit code with commitlint,then commit error.

Context

Using pnpm to manage lerna, unable to submit code after upgrading lerna.

commitlint --version

@commitlint/[email protected]

git --version

2.26.0.windows.1

node --version

16.14.0

@liangskyli liangskyli added the bug label Apr 6, 2023
@liangskyli
Copy link
Author

liangskyli commented Apr 6, 2023

Similar issues lerna/lerna#3579

@liangskyli
Copy link
Author

I change to @commitlint/config-pnpm-scopes is ok

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

1 participant