observing/pre-commit

Support .bashrc

Opened this issue · 17 comments

My loading of NVM on local dev machine is in .bashrc file and if i try to commit from Phpstorm it doesnt find the node executable

See if adding the .bashrc here: https://github.com/observing/pre-commit/blob/master/hook#L17-L19 resolves your problem.

That would, but even if i write source ~/.bashrc does not do anything.
I have even put nvm use into my .bashrc which echoes to the console, but still no output

if i put my nvm loading script into the precommit hook it works...seems like Phpstorm issue here

but of course .basrc should be in the repo also, ill make a PR

#57 Here it is

I have a similar issue with Sublime Text 3, which results in the following while attempting commit from within the editor:

.git/hooks/pre-commit: line 49: : command not found

When I run which node in from my terminal I see:

/Users/jhabdas/.nvm/versions/node/v4.2.3/bin/node

But I receive no output when running echo $(which node) from within the pre-commit shell script inside the editor.

krns commented

Hi, I am facing the same problem.. does anyone of you have a solution?

same problem with IntelliJ PHPStorm (and I'm assuming WebStorm will behave the same):

.git/hooks/pre-commit: line 49: : command not found

Committing via the command line yields no errors and works fine.
I'm using nvm as well, so:

$ which node
/home/peach/.nvm/versions/node/v5.12.0/bin/node

@3rd-Eden @ThePeach Jetbrains IDE's on Ubuntu still fail with it. Might be related to the IDE.

@ThePeach Can you open a ticket for them?

@BlackSonic reported as https://youtrack.jetbrains.com/issue/WI-33420, might be very well a problem with *Storm.

happens with gitg (on ubuntu) as well
the issue issue is due to HOME being empty

Was there any fix for this?

Having the same problem on Ubuntu running WebStorm 2017.1.4 & node 8 (npm 5)

@dschu-lab Do you still have an issue with the master?

@3rd-Eden Just installed #f25888ffc67d21beaa1572b53ab6704a67266b64 but facing the same problem. Sadly, I don't know how I could debug this. But if you want me to try anything, just ping me. 🍻

For me this was a hack to make it work: nvm-sh/nvm#688 (comment)

+1 in visual studio code. @levino what did implementation of that fix look like? I tried adding a

"pre-commit-fix": ". $NVM_DIR/nvm.sh"

to the pre-commit array, but it didn't change anything