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

use pnpm@8.1.0, lerna@6.6.1, @commitlint/config-lerna-scopes@17.4.2, Cannot find module '@lerna/project' error #3579

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",
pnpm@8.1.0

when i use lerna@6.6.1, 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\@cspotcode+source-map-support@0.8.1\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\import-from@4.0.0\node_modules\import-from\index.js:5:100)
    at xxx\node_modules\.pnpm\@commitlint+config-lerna-scopes@17.4.2_lerna@6.6.1\node_modules\@commitlint\config-lerna-scopes\index.js:45:26
    at async execute (xxx\node_modules\.pnpm\@commitlint+execute-rule@17.4.0\node_modules\@commitlint\execute-rule\src\index.ts:20:16)
    at async Promise.all (index 11)
    at async load (xxx\node_modules\.pnpm\@commitlint+load@17.5.0\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 lerna@6.6.1 doesn't have this package anymore(@lerna/project)
but have this package(@lerna/project) in lerna@6.4.1 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",pnpm@8.1.0
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/config-lerna-scopes@17.4.2

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