Skip to content

npm excute arg expected "--commitlint" but actualy "--" "commitlint" at yarn v3 PnP. #2990

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
yuhs0 opened this issue Jan 24, 2022 · 6 comments
Closed
4 tasks

Comments

@yuhs0
Copy link

yuhs0 commented Jan 24, 2022

npm execute arg expected "--commitlint" but actualy "--" "commitlint" at yarn v3 PnP.

Look this npm error log

$ git commit --file=/var/folders/sv/5vy67rf97ls0v_bhw8kv9vfm0000gn/T/EA6A451D-530A-451E-9E1E-176154BDFB09

(node:86392) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
[STARTED] Preparing lint-staged...
[SUCCESS] Preparing lint-staged...
[STARTED] Running tasks for staged files...
[STARTED] .husky/lintstagedrc.js — 1 file
[STARTED] *.{js,jsx,ts,tsx} — 1 file
[STARTED] {!(package)*.json,*.code-snippets,.!(browserslist)*rc} — 0 file
[STARTED] package.json — 0 file
[STARTED] *.vue — 0 file
[STARTED] *.{css,scss,less,styl,html,js,jsx,ts,tsx} — 1 file
[STARTED] *.md — 0 file
[SKIPPED] {!(package)*.json,*.code-snippets,.!(browserslist)*rc} — no files
[SKIPPED] package.json — no files
[SKIPPED] *.vue — no files
[SKIPPED] *.md — no files
[STARTED] eslint --fix
[STARTED] prettier --write
[SUCCESS] prettier --write
[SUCCESS] *.{css,scss,less,styl,html,js,jsx,ts,tsx} — 1 file
[SUCCESS] eslint --fix
[STARTED] prettier --write
[SUCCESS] prettier --write
[SUCCESS] *.{js,jsx,ts,tsx} — 1 file
[SUCCESS] .husky/lintstagedrc.js — 1 file
[SUCCESS] Running tasks for staged files...
[STARTED] Applying modifications from tasks...
[SUCCESS] Applying modifications from tasks...
[STARTED] Cleaning up temporary files...
[SUCCESS] Cleaning up temporary files...
🔍  Finding changed files since git revision c7d7ed1.
🎯  Found 1 changed file.
✅  Everything is awesome!
npm ERR! canceled

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/yuhansol/.npm/_logs/2022-01-24T00_26_59_329Z-debug-0.log
husky - commit-msg hook exited with code 1 (error)
cat /Users/yuhansol/.npm/_logs/2022-01-24T00_26_59_329Z-debug-0.log
0 verbose cli [
0 verbose cli   '/Users/yuhansol/.nvm/versions/node/v16.13.0/bin/node',
0 verbose cli   '/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js',
0 verbose cli   'exec',
0 verbose cli   '--no-yes',
0 verbose cli   '--',
0 verbose cli   'commitlint',
0 verbose cli   '--edit',
0 verbose cli   ''
0 verbose cli ]
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnode Completed in 0ms
4 timing config:load:defaults Completed in 0ms
5 timing config:load:file:/opt/homebrew/lib/node_modules/npm/npmrc Completed in 1ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:/Users/yuhansol/workspace/brandi-ai-cms-react/.npmrc Completed in 0ms
10 timing config:load:project Completed in 0ms
11 timing config:load:file:/Users/yuhansol/.npmrc Completed in 1ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:/opt/homebrew/etc/npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 0ms
18 timing config:load Completed in 5ms
19 timing npm:load:configload Completed in 5ms
20 timing npm:load:setTitle Completed in 6ms
21 timing config:load:flatten Completed in 1ms
22 timing npm:load:display Completed in 1ms
23 verbose logfile /Users/yuhansol/.npm/_logs/2022-01-24T00_26_59_329Z-debug-0.log
24 timing npm:load:logFile Completed in 3ms
25 timing npm:load:timers Completed in 0ms
26 timing npm:load:configScope Completed in 0ms
27 timing npm:load Completed in 15ms
28 silly logfile start cleaning logs, removing 1 files
29 http fetch GET 200 https://registry.npmjs.org/commitlint 827ms (cache revalidated)
30 timing arborist:ctor Completed in 1ms
31 timing arborist:ctor Completed in 0ms
32 timing command:exec Completed in 856ms
33 verbose stack Error: canceled
33 verbose stack     at exec (/opt/homebrew/lib/node_modules/npm/node_modules/libnpmexec/lib/index.js:154:17)
33 verbose stack     at async module.exports (/opt/homebrew/lib/node_modules/npm/lib/cli.js:66:5)
34 verbose cwd /Users/yuhansol/workspace/brandi-ai-cms-react
35 verbose Darwin 21.2.0
36 verbose argv "/Users/yuhansol/.nvm/versions/node/v16.13.0/bin/node" "/opt/homebrew/lib/node_modules/npm/bin/npm-cli.js" "exec" "--no-yes" "--" "commitlint" "--edit" ""
37 verbose node v16.13.0
38 verbose npm  v8.3.0
39 error canceled
40 verbose exit 1
41 timing npm Completed in 1076ms
42 verbose code 1
43 error A complete log of this run can be found in:
43 error     /Users/yuhansol/.npm/_logs/2022-01-24T00_26_59_329Z-debug-0.log

Current Behavior

Affected packages

  • cli
  • core
  • prompt
  • config-angular

Possible Solution

Steps to Reproduce (for bugs)

  1. First step: Set yarn version berry(v3)
  2. Second step: git commit

Context

Your Environment

Executable Version
commitlint --version 16.1.0
git --version 2.32.0 (Apple Git-132)
node --version 16.13.0
@escapedcat
Copy link
Member

How did you install husky and commitlint?

@yuhs0
Copy link
Author

yuhs0 commented Jan 24, 2022

How did you install husky and commitlint?

I install husky and commitlint using yarn v1, then migrated to yarn v3.

Here is my partial package.json

{
  ...
  "devDependencies": {
    "@commitlint/cli": "^16.1.0",
    "@commitlint/config-conventional": "^16.0.0",
    "@storybook/addon-actions": "^6.4.14",
    "@storybook/addon-essentials": "^6.4.14",
    "@storybook/addon-links": "^6.4.14",
    "@storybook/builder-webpack5": "^6.4.14",
    "@storybook/manager-webpack5": "^6.4.14",
    "@storybook/node-logger": "^6.4.14",
    "@storybook/preset-create-react-app": "^4.0.0",
    "@storybook/react": "^6.4.14",
    "@types/eslint": "^8.4.1",
    "@types/react-is": "^17.0.3",
    "@types/webpack-env": "^1.16.3",
    "@typescript-eslint/eslint-plugin": "^5.10.0",
    "@typescript-eslint/parser": "^5.10.0",
    "css-loader": "^6.5.1",
    "customize-cra": "^1.0.0",
    "eslint": "^8.7.0",
    "eslint-config-prettier": "^8.3.0",
    "eslint-define-config": "^1.2.3",
    "eslint-plugin-import": "^2.25.4",
    "eslint-plugin-import-helpers": "^1.2.1",
    "eslint-plugin-prettier": "^4.0.0",
    "eslint-plugin-react": "^7.28.0",
    "eslint-plugin-react-hooks": "^4.3.0",
    "eslint-plugin-react-redux": "^3.3.4",
    "husky": "^7.0.4",
    "lint-staged": "^12.3.1",
    "postcss": "^8.4.5",
    "prettier": "^2.5.1",
    "pretty-quick": "^3.1.3",
    "sass-loader": "^12.4.0",
    "style-loader": "^3.3.1",
    "stylelint": "^14.3.0",
    "stylelint-config-prettier": "^9.0.3",
    "stylelint-config-recommended": "^6.0.0",
    "stylelint-config-standard": "^24.0.0",
    "stylelint-config-standard-scss": "^3.0.0",
    "stylelint-config-styled-components": "^0.1.1",
    "stylelint-order": "^5.0.0",
    "stylelint-prettier": "^2.0.0",
    "stylelint-processor-styled-components": "^1.10.0",
    "tsconfig-paths-webpack-plugin": "^3.5.2",
    "webpack": "5.67.0"
  },
  "packageManager": "[email protected]"
}

@escapedcat
Copy link
Member

Does this help?: #2637 (comment)

@yuhs0
Copy link
Author

yuhs0 commented Jan 24, 2022

Does this help?: #2637 (comment)

I tried yarn run commitlint --edit "$1" but it's not working my case.
Problem not solved.

@escapedcat escapedcat reopened this Mar 1, 2022
@yuhs0
Copy link
Author

yuhs0 commented Mar 2, 2022

Now this is solved.
This is absolutely my fault. I'm sorry to everyone.

Before my .husky/commit-msg file.

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

npx --no -- commitlint --edit ""

After yarn v3 can't use npx command.
And wrong command --no -- commitlint --edit ""

So I modify it.

#!/bin/sh
. "$(dirname "$0")/_/husky.sh"

yarn dlx commitlint --edit $1

@yuhs0 yuhs0 closed this as completed Mar 2, 2022
@escapedcat
Copy link
Member

👏 Great you figured it out!
You think we should update the README here to show how it works with yarn v3?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

2 participants