Git pre-commit hook failing in GitHub for mac (works on command line)

前端 未结 3 605
后悔当初
后悔当初 2021-02-07 02:52

I\'ve created a very simple pre-commit script:-

#!/usr/bin/env sh

# Run tests
npm test
if [ $? -ne 0 ]; then
  echo \"Tests failed. Aborting..\"
  exit 1
fi

ex         


        
3条回答
  •  梦毁少年i
    2021-02-07 03:44

    Resolved. As globally installed node modules end up under /usr/local/bin I simply needed to add the following at the beginning of my pre-commit:

    PATH=$PATH:/usr/local/bin:/usr/local/sbin
    

    i.e. appending both /usr/local/bin and /usr/local/sbin to PATH at the point of execution.

提交回复
热议问题