When the hook is installed in a git submodule the return value of getNodeModulesAbsoluteEntryPoint() is a static path from the time the hook file was generated. This causes problems if you are using containers as part of your dev workflow. Basically the hook fails if you run git from outside the container when the hook was installed from inside the container (and vise-versa).
Doing something like the following should solve the problem:
let _nodeModulesPath = path.resolve(__dirname, '../', '../', 'node_modules')
if (! fs.existsSync(_nodeModulesPath)) {
// We might be in a git submodule
const prefix = __dirname.split(/[/\\]\.git[/\\]/).shift()
const suffix = __dirname.split(/[/\\]hooks[/\\]/).pop()
_nodeModulesPath = path.resolve(path.relative(__dirname, `${prefix}${path.sep}${suffix}`), 'node_modules')
}