Closed fhemberger closed 9 years ago
Which version of pre-commit are you using?
Did a fresh npm install
: v1.1.1
And what platform is this?
OS X v10.9.5 zsh v5.0.8 iojs v2.5.0
I also had this issue.
pre-commit v1.1.1 OS X v10.10.3 OS X bash v3.2.57 node v0.12.7
$ git commit
module.js:338
throw err;
^
Error: Cannot find module '/Users/lauren/code/my'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
Where the full file path would be something like:
'/Users/lauren/code/my projects/folder/current-repo'
Changing "my projects" to "my-projects" made it possible to commit to the repo as expected again.
@fhemberger @LaurenJanicki we had the same problem here, just some missing quotes. You can fix it quickly by going to your hooks directory (.git/hooks) and changing the line 49 in the pre-commit file from:
"$BINARY" $("$BINARY" -e "console.log(require.resolve('pre-commit'))")
to
"$BINARY" "$("$BINARY" -e "console.log(require.resolve('pre-commit'))")"
@3rd-Eden I can create a pull request if you want, I'll write some tests to cover that case.
Thanks. Would be great if this patch could land in the next release.
I thought it was already fixed.
@3rd-Eden Nope, both reports were for v1.1.1.
Closed through #52.
Released as 1.1.2
Same error here on Windows 10 with node v5.6.0 and zsh v5.0.6:
{ base16-builder } master » git commit -m "docs(contributing): Add missing links"
module.js:341
throw err;
^
Error: Cannot find module 'C:\home\alois\source\base16-builder\.git\hooks\pre-commit'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Function.Module.runMain (module.js:447:10)
at startup (node.js:140:18)
at node.js:1001:3
I added --no-verify to the end of the commit and it forced it to run. Not sure why that worked but it did.
I just installed pre-commit for a project which contains a space in the path name (e.g.
/projects/example path
).npm test
itself runs fine, but when I try to commit, I get the following error: