Thanks to visit codestin.com
Credit goes to github.com

Skip to content

[BUG] npm version: --no-commit-hooks output git commit "-n" instead of "--no-verify" #647

@rhengles

Description

@rhengles

What / Why

I'm running npm version --no-commit-hooks in my project, but it fails with the message:

npm ERR! code 1
npm ERR! Command failed: git commit -m build: release 2.6.11 -n
npm ERR!

After searching, it seems the cause is the -n argument. From the git documentation [1], the correct argument is --no-verify and there is no -n shortcut.

[1] https://git-scm.com/docs/git-commit/1.5.5#git-commit---no-verify

Source: https://github.com/npm/cli/blob/latest/lib/version.js#L290

Below is the relevant log information:

0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/usr/bin/node',
1 verbose cli   '/usr/bin/npm',
1 verbose cli   'version',
1 verbose cli   '2.6.11',
1 verbose cli   '--no-commit-hooks',
1 verbose cli   '--allow-same-version',
1 verbose cli   '--message',
1 verbose cli   'build: release 2.6.11'
1 verbose cli ]
2 info using [email protected]
3 info using [email protected]
4 info git [ 'status', '--porcelain' ]
5 info lifecycle @arijs/[email protected]~preversion: @arijs/[email protected]
6 verbose version.write data

// snip package.json

7 info lifecycle @arijs/[email protected]~version: @arijs/[email protected]
8 info git [ 'add', '/mnt/d/dev/github/vue/package.json' ]
9 info git [ 'commit', '-m', 'build: release 2.6.11', '-n' ]
10 verbose stack Error: Command failed: git commit -m build: release 2.6.11 -n      
10 verbose stack
10 verbose stack     at ChildProcess.exithandler (child_process.js:290:12)
10 verbose stack     at ChildProcess.emit (events.js:200:13)
10 verbose stack     at maybeClose (internal/child_process.js:1021:16)
10 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
11 verbose cwd /mnt/d/dev/github/vue
12 verbose Linux 4.4.0-18362-Microsoft
13 verbose argv "/usr/bin/node" "/usr/bin/npm" "version" "2.6.11" "--no-commit-hooks" "--allow-same-version" "--message" "build: release 2.6.11"
14 verbose node v12.4.0
15 verbose npm  v6.12.1
16 error code 1
17 error Command failed: git commit -m build: release 2.6.11 -n
18 verbose exit [ 1, true ]

When

  • When running npm version --no-commit-hooks

Where

How

Current Behavior

  • npm version --no-commit-hooks fails

Steps to Reproduce

  • n/a

Expected Behavior

  • npm version --no-commit-hooks succeeds

Who

  • n/a

References

  • n/a

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions