Skip to content

[Bug] Husky hook erroring out #100

Closed
@jklmli

Description

@jklmli

My package.json configuration looks like this:

{
  "scripts": {
    "commitmsg": "commitplease",
  },
  "commitplease": {
    "nohook": true,
    "style": "angular",
    "types": ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "style", "test"]
  },
}

When I commit something with this setup, I get this error:

$ git commit --amend
husky > npm run -s commitmsg (node v6.10.2)

path.js:7
    throw new TypeError('Path must be a string. Received ' + inspect(path));
    ^

TypeError: Path must be a string. Received undefined
    at assertPath (path.js:7:11)
    at Object.normalize (path.js:1177:5)
    at module.exports (/Users/kevin/Code/monapt/node_modules/commitplease/index.js:98:12)
    at Object.<anonymous> (/Users/kevin/Code/monapt/node_modules/commitplease/commitplease.js:3:24)
    at Module._compile (module.js:570:32)
    at Object.Module._extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    at Function.Module._load (module.js:438:3)
    at Module.runMain (module.js:604:10)

husky > commit-msg hook failed (add --no-verify to bypass)

Is this an issue with the documentation or a bug in the code?
My current workaround is to set:

  "scripts": {
    "commitmsg": "commitplease .git/COMMIT_EDITMSG",
  }

which is working fine.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions