Comments (22)
Even easier in a root command prompt just call node ./node_modules/pre-commit/install.js
which will call the original install script provided by pre-commit
and install the symlinked file for you
from pre-commit.
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.
from pre-commit.
@alallier Thanks for your time!
Found where is problem.
In my project .git
folder not at the same level as node_modules
, it located in parent folder.
Now pre-commit
fails silently if not found .git
folder at the same level.
There is pull-request #55. But not merged yet
from pre-commit.
@alallier Your suggestion fixed it for me, thanks. Windows 10 Node 4.4.7
from pre-commit.
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.
from pre-commit.
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 i
again the error won't show, because the install.js
in not ran again, once pre-commit has already been installed.
from pre-commit.
thank @alallier , I try it under the win10 System Node 6.3.0. And it succeeds.
from pre-commit.
this should be solved by #84
from pre-commit.
Also experiencing the same issue.
from pre-commit.
Same goes for me as well on Windows 10 x64 and Node 6.2.0.
from pre-commit.
I appreciate that this doesn't resolve the install scenario - but a quick fix can be to manually create the NTFS junction (symlink) yourself. From elevated PowerShell prompt in your repo's .git/hooks/ folder:
cmd /c mklink /H pre-commit ..\..\node_modules\pre-commit\hook
from pre-commit.
I confirm what @janis-kra said I received no error at all, it simply just didn't write the file.
from pre-commit.
+1
from pre-commit.
Its interesting because earlier versions didn't suffer this issue.
from pre-commit.
How about just copy the file instead in case symlink fails?
from pre-commit.
I'd prefer the elevate approach as well, if things need it, so be it, no biggie
windows also allows you to run mklink without elevated privileges trough a local policy, but not everyone is going to go that way, and besides,
admin accounts are unaffected by this setting, they still need elevated access
from pre-commit.
Maybe this is the reason:
1a04430
This change might help when moving or renaming the project directory... but it will stop working on Windows.
fs.symlinkSync() seems to have problems making relative 'junction' symlinks on Windows (as per https://nodejs.org/api/fs.html#fs_fs_symlink_target_path_type_callback)
nodejs.org doesn't say that it would also fail for 'file' symlinks, but it smells suspicious... seems like it started failing after that commit was added.
from pre-commit.
I had to adapt @robsimm solution but it worked for me, at least for the moment, until someone fix the issue. You guys can run it on Windows Prompt cmd /c mklink pre-commit ..\..\node_modules\pre-commit\hook
with root access.
from pre-commit.
@alallier trying on Win 8, Node 7.9.0 executing node ./node_modules/pre-commit/install.js
. No messages, no errors, no pre-commit file in git hooks
from pre-commit.
@Alex-Sokolov not sure about the errors, but trying running node ./node_modules/pre-commit/install.js
in an admin cmd
from pre-commit.
@alallier thanks for answer! Sadly, but as admin in cmd also no success
from pre-commit.
@Alex-Sokolov not sure what's going on then without more details, that is what worked for me and many others in this issue thread.
from pre-commit.
Related Issues (20)
- Add environment variable
- doesn't work with vue-cli v3.x HOT 1
- Error on windows commit (hook: line 49: : command not found) HOT 9
- Document how to turn this off permanently HOT 3
- install.js doesn't work with link file of .git.
- Question: Prevent pre-commit hook to continue on committing? HOT 5
- Does not find correct root. HOT 1
- Doesn't find git root when inside a submodule
- Commit f25888f doesnt seem to have been pushed to npm
- How to make pre-commit works just with npm ci?
- can't find any error detail HOT 1
- How to run pre-commit hook in docker container?
- make it compatible with yarn pnp
- [Bug] pre-commit don't work HOT 1
- pre-commit
- chmod 777 breaks CIS 6.1.10 (ensure no world writable files)
- [BUG] Install with --force Flag Overwrites pre-commit.old
- Is there any relationship with pre-commit.com?
- Package maintainance HOT 4
- pre-commit hook not working on macos
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pre-commit.