kazazor / git-pre-commit

A pre-commit hook that ignores all the unstagged changes while performing the pre-commit command you wrote (Using Shell, Gulp, Grunt etc..)
https://www.npmjs.com/package/git-pre-commit
MIT License
18 stars 5 forks source link

Windows - must npm install with admin permissions #19

Closed kazazor closed 8 years ago

kazazor commented 8 years ago

Getting the following error:

> gulp hooks:install

[01:08:18] Using gulpfile ~\test\test\node_modules\git-pre-commit\Gulpfile.js
[01:08:18] Starting 'hooks:clean'...
[01:08:18] "Deleting file: C:\\Users\\orkazaz\\test\\test\\.git\\hooks\\pre-comm
it,C:\\Users\\orkazaz\\test\\test\\.git\\hooks\\pre-commit.js"
[01:08:18] Finished 'hooks:clean' after 141 ms
[01:08:18] Starting 'hooks:install'...
[01:08:18] Starting 'hooks:pre-commit'...
[01:08:18] Starting 'hooks:pre-commit-js'...
[01:08:18] 'hooks:pre-commit' errored after 23 ms
[01:08:18] Error: EPERM: operation not permitted, symlink 'C:\Users\orkazaz\test
\test\node_modules\git-pre-commit\scripts\pre-commit' -> 'C:\Users\orkazaz\test\
test\.git\hooks\pre-commit'
    at Error (native)
[01:08:18] Finished 'hooks:install' after 29 ms
[01:08:18] 'hooks:pre-commit-js' errored after 18 ms
[01:08:18] Error: EPERM: operation not permitted, symlink 'C:\Users\orkazaz\test
\test\node_modules\git-pre-commit\scripts\pre-commit.js' -> 'C:\Users\orkazaz\te
st\test\.git\hooks\pre-commit.js'
    at Error (native)
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\
node_modules\\npm\\bin\\npm-cli.js" "i"
npm ERR! node v4.3.1
npm ERR! npm  v2.14.12
npm ERR! code ELIFECYCLE

npm ERR! git-pre-commit@0.1.8 postinstall: `gulp hooks:install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the git-pre-commit@0.1.8 postinstall script 'gulp hooks:insta
ll'.
npm ERR! This is most likely a problem with the git-pre-commit package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     gulp hooks:install
npm ERR! You can get their info via:
npm ERR!     npm owner ls git-pre-commit
npm ERR! There is likely additional logging output above.

> git-pre-commit@0.1.8 uninstall C:\Users\orkazaz\test\test\node_modules\git-pre
-commit
> gulp hooks:clean

[01:08:20] Using gulpfile ~\test\test\node_modules\git-pre-commit\Gulpfile.js
[01:08:20] Starting 'hooks:clean'...
[01:08:20] "Deleting file: C:\\Users\\orkazaz\\test\\test\\.git\\hooks\\pre-comm
it,C:\\Users\\orkazaz\\test\\test\\.git\\hooks\\pre-commit.js"
[01:08:20] Finished 'hooks:clean' after 92 ms

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\orkazaz\test\test\npm-debug.log

C:\Users\orkazaz\test\test>

By default the cmd tool runs with NON admin permissions. So in order to create a symlink on windows we need to run as administrators. Which doesn't makes any sense for a cross platform package.

Find a better way of doing that.

kazazor commented 8 years ago

This was fixed by removing the use of symlink in #25