Skip pre-commit hook in "npm version" command

Viewed 8110

npm version commits the change to package.json and creates a tag. Is there a way to prevent commit hook from being executed while using this command?

5 Answers

From the docs

commit-hooks

  • Default: true
  • Type: Boolean

Run git commit hooks when using the npm version command.

If you simply want to allow this one time run the follow

npm version --no-commit-hooks patch|minor|major

To control this permanently, run the following command

npm config set commit-hooks false

Or add this line to your .npmrc file

commit-hooks=false

I tried all the above solutions, nothing worked for me.

the below command works well.

git commit -m "message" --no-verify

The following worked for me in a Git repo if you're looking for no tag and no commit but just the increment. (Replace patch with major or minor depending on your use case)

npm --no-git-tag-version version patch
Related