pre-commit: It does not write pre-commit file in hooks folder on Windows
Pretty much a duplicate of #43
pre-commit:
pre-commit: Failed to symlink the hook file in your .git/hooks folder because:
pre-commit: EPERM: operation not permitted, symlink '..\..\node_modules\pre-commit\hook' -> 'C:\path\to\glory\.git\hooks\pre-commit'
pre-commit: The hook was not installed.
pre-commit:
However, I’d like to share some more info: https://en.wikipedia.org/wiki/NTFS_symbolic_link
Ideally, we could request elevation something like https://www.npmjs.com/package/windows-elevate or call a native function.
Thanks!
About this issue
- Original URL
- State: open
- Created 8 years ago
- Reactions: 1
- Comments: 22 (4 by maintainers)
Even easier in a root command prompt just call
node ./node_modules/pre-commit/install.jswhich will call the original install script provided bypre-commitand install the symlinked file for you@alallier Thanks for your time!
Found where is problem. In my project
.gitfolder not at the same level asnode_modules, it located in parent folder. Nowpre-commitfails silently if not found.gitfolder at the same level.There is pull-request https://github.com/observing/pre-commit/pull/55. But not merged yet
Same result for me, although I did not get that error message (in fact I did not get any error, it just did not write the file). The solution in #43 did not work for me.
thank@alallier

I had to try ‘pre-commit’, but it does not work because of having no ‘pre-commit’ file. so I use
node ./node_modules/pre-commit/install.js, it work successfully.@alallier Your suggestion fixed it for me, thanks. Windows 10 Node 4.4.7
this should be solved by https://github.com/observing/pre-commit/pull/84
thank @alallier , I try it under the win10 System Node 6.3.0. And it succeeds.
UPDATE: Per my previous comment, upon further testing I disocvered that pre-commit will show the error on the initial install of pre-commit, but if you are to discover that it symlink isn’t installed (like it doesn’t in Windows without being Administrator) and run the
npm iagain the error won’t show, because theinstall.jsin not ran again, once pre-commit has already been installed.