jish / pre-commit

A slightly improved pre-commit hook for git
https://jish.github.io/pre-commit/
Other
797 stars 96 forks source link

Could not load execjs #234

Open erayalakese opened 8 years ago

erayalakese commented 8 years ago
$ git --version
git version 2.3.8 (Apple Git-58)

$ sudo gem install pre-commit
Password:
Fetching: pluginator-1.3.0.gem (100%)
Successfully installed pluginator-1.3.0
Fetching: pre-commit-0.26.0.gem (100%)
Successfully installed pre-commit-0.26.0
Parsing documentation for pluginator-1.3.0
Installing ri documentation for pluginator-1.3.0
Parsing documentation for pre-commit-0.26.0
Installing ri documentation for pre-commit-0.26.0
2 gems installed

$ git init
Initialized empty Git repository in /Users/erayalakese/Desktop/COP/precommittest/.git/

$ pre-commit install
Installed /Library/Ruby/Gems/2.0.0/gems/pre-commit-0.26.0/templates/hooks/default to .git/hooks/pre-commit

$ touch asd

$ git add asd

$ git commit -m 'sss'
Could not load execjs: cannot load such file -- execjs
[master (root-commit) 6129c1b] sss
 1 file changed, 0 insertions(+), 0 deletions(-)
 create mode 100644 asd

$ nano eray.php  <<< php file with bad syntax

$ git add eray.php 

$ git commit -m 'xzczxvzxcv'
Could not load execjs: cannot load such file -- execjs
[master 0430969] xzczxvzxcv
 1 file changed, 3 insertions(+)
 create mode 100644 eray.php
jish commented 8 years ago

That is likely coming from one of the JavaScript checks. If you're doing solely PHP development you can disable the Rails checks:

$ pre-commit disable git checks rails

Or if you do want the JavaScript checks to run, try installing the execjs gem

$ gem install execjs